问题
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.
来源:https://stackoverflow.com/questions/44001239/access-on-prem-db2-from-dsx