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:
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.