Accessing DB2 with Python

Discussion in 'Python' started by Shawn Milo, Dec 16, 2004.

  1. Shawn Milo

    Shawn Milo Guest

    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
     
    Shawn Milo, Dec 16, 2004
    #1
    1. Advertising

  2. Hi !

    it's not a web site, it's FTP...
     
    Michel Claveau - abstraction méta-galactique non t, Dec 16, 2004
    #2
    1. Advertising

  3. Shawn Milo

    Larry Bates Guest

    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.

    Shawn Milo wrote:
    > 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
     
    Larry Bates, Dec 16, 2004
    #3
  4. Jean Brouwers, Dec 16, 2004
    #4
  5. Shawn Milo

    Jan Dries Guest

    Shawn Milo wrote:
    > 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
     
    Jan Dries, Dec 16, 2004
    #5
  6. Shawn Milo

    Jarek Zgoda Guest

    Larry Bates wrote:

    > 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/
     
    Jarek Zgoda, Dec 16, 2004
    #6
  7. Shawn Milo

    Grumman Guest

    Jarek Zgoda wrote:
    > 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.
     
    Grumman, Dec 17, 2004
    #7
  8. Simon Brunning, Dec 17, 2004
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    7,684
  2. P. Adhia
    Replies:
    0
    Views:
    336
    P. Adhia
    May 21, 2007
  3. P. Adhia
    Replies:
    0
    Views:
    267
    P. Adhia
    May 21, 2007
  4. Dinesh
    Replies:
    0
    Views:
    184
    Dinesh
    Apr 3, 2006
  5. Replies:
    0
    Views:
    196
Loading...

Share This Page