我已经安装了pyodbc并配置了系统ODBC。还有什么我应该配置的吗?
pyodbc.autocommit=True
conn = pyodbc.connect("DSN=Cloudera Impala DSN", autocommit=True)
print("pass")
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()