Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
157 views
Welcome To Ask or Share your Answers For Others

1 Answer

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...