我已经安装了pyodbc并配置了系统odbc。还有什么需要配置的吗?
pyodbc.autocommit=True conn = pyodbc.connect("DSN=Cloudera Impala DSN", autocommit=True) print("pass") cursor = conn.cursor()
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()
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()
1条答案
按热度按时间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()