pyodbc与cloudera impala的连接在colab上失败

vzgqcmou  于 2021-06-26  发布在  Impala
关注(0)|答案(1)|浏览(540)

我已经安装了pyodbc并配置了系统odbc。还有什么需要配置的吗?

pyodbc.autocommit=True
conn = pyodbc.connect("DSN=Cloudera Impala DSN", autocommit=True)
print("pass")
cursor = conn.cursor()


s71maibg

s71maibg1#

你可以用- conn = pyodbc.connect(DSN="Cloudera Impala DSN", autocommit=True) 我们使用 cfg = {'DSN': 'Cloudera Impala DSN', 'host': 'xx.com', 'port': 1234,'username': 'uu', 'password': 'pp'} conn_string='DSN=%s; database='default';AuthMech=3;UseSASL=1; UID=%s; PWD=%s; SSL=1;AllowSelfSignedServerCert=1;CAIssuedCertNamesMismatch=1' %(cfg['DSN'], cfg['username'], cfg['password']) conn = pyodbc.connect(conn_string, autocommit=True) cursor = conn.cursor()

相关问题