Access on prem DB2 from DSX

纵然是瞬间 提交于 2020-01-07 09:36:50

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!