Access on prem DB2 from DSX

2019-09-19 19:28发布

I am trying to access on prem DB2 data from DSX using a Python notebook in Jupyter. I have uploaded db2jcc.jar & license jar files to my home directory but how do I add the directory to the classpath ? Is there another to

1条回答
倾城 Initia
2楼-- · 2019-09-19 20:05

You can alternatively use connector available on DSX to connect to DB2 on prem.

from ingest import Connectors
from pyspark.sql import SQLContext
sqlContext = SQLContext(sc)
DB2loadOptions = { 
                 Connectors.DB2.HOST              : '***********',
                 Connectors.DB2.PORT              : '***********',
                 Connectors.DB2.DATABASE          : '*********',
                 Connectors.DB2.USERNAME          : '***********',
                 Connectors.DB2.PASSWORD          : '***********',
                  Connectors.DB2.SOURCE_TABLE_NAME         : '***********'}
DB2DF.printSchema()
DB2DF.show()

Ref:- https://datascience.ibm.com/docs/content/analyze-data/python_load.html#ibm-db2

I believe you must be using gateway or some way to connect to your on-prem db2. https://datascience.ibm.com/blog/working-with-on-premises-databases-step-by-step/

Thanks, Charles.

查看更多
登录 后发表回答