Discussion:
Accessing DB2 with Python
Grumman
2004-12-17 01:20:09 UTC
Permalink
Be aware, that it's a module for "normal" DB2, not a DB2/400. To access
DB2/400 you have to use ClientAccess ODBC (from Windows or *nix
platform) driver or iSeries port of Python (from AS/400).
And just to be complete, under windows, using win32all, you can also use
the OLE DB driver supplied with ClientAccess (IBMDA400), which offers
some improvements over plain ODBC.

Its been a long time since I did this, but it was *very* simple. I
could probably dig up an example or two if necessary.

Connection string basically looks like:
Provider=IBMDA400;User ID=USERNAME;Password=PASSWORD;Initial
Catalog=DATABASE_NAME;Data
Source=AS_400_SERVER_NAME

Provider,User ID, Password, and Data Source are required. Data Source
can be either an IP address, or a DNS defined hostname. I've never
bothered with 'Initial Catalog', but it would be one of the database
names visible via WRKDBR. (Usually defaults to the default system name,
which is shipped set to the system serial#)

Optionally, you can add 'Catalog Library List=Lib1 Lib2 Lib3' to add
additional libraries to the current library list for the connection.

Last I knew, there were a few methods exposed by ADO that weren't
supported via this driver, but like I said, its been a long time.

I'm sure there's a pretty complete python ADO wrapper out there as well.
Larry Bates
2004-12-16 20:00:33 UTC
Permalink
I just tried the link at it works from here. Site has
source and Windows binary versions of software. Looks
loke it is being maintained. Windows binary for Python
2.3 was added in September 2004. No 2.4 binary.

Larry Bates
Syscon, Inc.
Is anyone doing this? I would like to access a DB2 database (IBM's database)
with Python. I checked "Python in a Nutshell," and it refers to
ftp://people.linuxkorea.co.kr/pub/db2, but I am unable to connect
to that site, although it could be a firewall issue, as I am at work.
Is there any commonly used module for this?
Thanks,
Shawn
Jarek Zgoda
2004-12-16 21:22:09 UTC
Permalink
Post by Larry Bates
I just tried the link at it works from here. Site has
source and Windows binary versions of software. Looks
loke it is being maintained. Windows binary for Python
2.3 was added in September 2004. No 2.4 binary.
Be aware, that it's a module for "normal" DB2, not a DB2/400. To access
DB2/400 you have to use ClientAccess ODBC (from Windows or *nix
platform) driver or iSeries port of Python (from AS/400).
--
Jarek Zgoda
http://jpa.berlios.de/ | http://www.zgodowie.org/
Jan Dries
2004-12-16 20:16:45 UTC
Permalink
Is anyone doing this? I would like to access a DB2 database (IBM's database)
with Python. I checked "Python in a Nutshell," and it refers to
ftp://people.linuxkorea.co.kr/pub/db2, but I am unable to connect to
that site, although it could be a firewall issue, as I am at work.
Is there any commonly used module for this?
You could try mxODBC. It has support for DB2. You can find it at:
http://www.egenix.com/files/python/mxODBC.html
You can download it for free and use it for a 30 day evaluation period.
After that, you must pay for a commercial license.

Regards,
Jan
Michel Claveau - abstraction méta-galactique non triviale en fuite perpétuelle.
2004-12-16 19:51:36 UTC
Permalink
Hi !

it's not a web site, it's FTP...
Simon Brunning
2004-12-17 14:23:02 UTC
Permalink
Post by Grumman
I'm sure there's a pretty complete python ADO wrapper out there as well.
http://adodbapi.sourceforge.net/
--
Cheers,
Simon B,
simon at brunningonline.net,
http://www.brunningonline.net/simon/blog/
Shawn Milo
2004-12-16 18:23:58 UTC
Permalink
Is anyone doing this? I would like to access a DB2 database (IBM's database)
with Python. I checked "Python in a Nutshell," and it refers to
ftp://people.linuxkorea.co.kr/pub/db2, but I am unable to connect
to that site, although it could be a firewall issue, as I am at work.

Is there any commonly used module for this?

Thanks,
Shawn
Jean Brouwers
2004-12-16 20:11:31 UTC
Permalink
Try <ftp://people.linuxkorea.co.kr/pub/DB2> with capital DB.

/Jean Brouwers


In article <mailman.7878.1103221440.5135.python-list at python.org>, Shawn
ftp://people.linuxkorea.co.kr/pub/db2,
Continue reading on narkive:
Loading...