DB2 connection through pyodbc and pandas.io.sql in

2019-07-24 11:32发布

问题:

I am trying to connect to IBM DB2 through python using pyodbc and pandas.io.sql, now the twist is I am not Super User or better to say I dont have any right to install DB2 Driver or anything else.

Is it possible to use pyodbc and pandas.io.sql to connect to DB2 with such conditions.

The code which I used so far is

cnxn = pyodbc.connect('Driver={FreeTDS}; Hostname=eee;Port=25369;Protocol=TCPIP;Database=rt;CurrentSchema=abc;UID=abc;PWD=efg;')

Error

pyodbc.Error: ('IM002', '[IM002] [unixODBC][Driver Manager]Data source name not found, and no default driver specified (0) (SQLDriverConnect)')

Or is it possible to check if there is preinstalled DB2 driver.

回答1:

At a minimum you need the IBM Data Server Driver for ODBC and CLI. You don't need to be root to install it, it's just a bunch of libraries. Find the correct version here: http://www-01.ibm.com/support/docview.wss?uid=swg24033997