从DSX访问prem DB2 [英] Access on prem DB2 from DSX
问题描述
我正在尝试使用Jupyter中的Python笔记本从DSX访问prem DB2数据.我已上传db2jcc.jar&将jar文件许可到我的主目录,但是如何将目录添加到类路径?还有另一个
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
推荐答案
您也可以使用DSX上可用的连接器连接到Prem上的DB2.
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()
参考:- https://datascience.ibm.com/docs/content/analyze-data/python_load.html#ibm-db2
我相信您必须使用网关或某种方式来连接到本地db2. https://datascience.ibm.com /blog/使用本地数据库进行逐步操作/
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/
谢谢, 查尔斯.
这篇关于从DSX访问prem DB2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!