pyodbc driver for DB2 database - Please Help

1,664 views
Skip to first unread message

bansi

unread,
Dec 15, 2010, 10:29:20 AM12/15/10
to pyodbc, mkleeham...@gmail.com

I downloaded Python 2.7 (python-2.7.1.amd64.msi) and pyodbc the python
extension module (i.e. pyodbc-2.1.8.win-amd64-py2.7.exe)

I wrote a sample script as shown below to connect to database

import csv
import pyodbc
conn =
pyodbc.connect("Driver={db2};Database=TEST001;Hostname=db2server;Port=5­­
0001;Protocol=TC

PIP;Uid=username;Pwd=password;",
autocommit = True , ansi = True)
curs = conn.cursor()
curs.execute('select count(edokimp_id) from edokimp')
print curs.fetchall()

The script resulted in following error

pyodbc.Error: ('IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data
source na
me not found and no default driver specified (0) (SQLDriverConnectW)')

I thought pyodbc is shipped with DB2 driver. From the error i realize
that i need to download separate driver for DB2 database. So Could you
please point me to the website where i can download the appropriate
driver for DB2 database and later how to configure it so that the
script works.

Thanks for your time in advance as i am newbie to Python with JAVA
experience.

Alexander

unread,
Dec 17, 2010, 6:22:09 AM12/17/10
to pyodbc
On Dec 15, 4:29 pm, bansi <mail2ba...@gmail.com> wrote:

> I thought pyodbc is shipped with DB2 driver. From the error i realize
> that i need to download separate driver for DB2 database. So Could you
> please point me to the website where i can download the appropriate
> driver for DB2 database and later how to configure it so that the
> script works.

bansi,

I have not worked with DB2 yet, but I guess (1) you need to install
the DB2 ODBC driver and (2) you should configure a DSN (using
odbcad32.exe on 32bit Windows).

Please have a look at "IBM DB2 Driver for ODBC and CLI overview"
http://publib.boulder.ibm.com/infocenter/db2luw/v9/topic/com.ibm.db2.udb.apdv.cli.doc/doc/c0023378.htm

Alexander

bansi

unread,
Jan 28, 2011, 3:03:36 PM1/28/11
to pyodbc
Thanks Alexander. I did downloaded IBM DB2 driver and were able to
successfully connect to database.
So far it works great but it doesnt serve my purpose because pyodbc
doesn't support Python 2.6 meaning i wasn't able to find pyodbc
installation software for Python 2.6 on Windows 2008 64 bit OS

Please point me to the link from where i can download if its available
otherwise its big limitation on part of pyodbc

Regards,
Bansi
> Please have a look at "IBM DB2 Driver for ODBC and CLI overview"http://publib.boulder.ibm.com/infocenter/db2luw/v9/topic/com.ibm.db2....
>
> Alexander
Reply all
Reply to author
Forward
0 new messages