Topic
  • 14 replies
  • Latest Post - ‏2006-03-27T22:35:35Z by SystemAdmin
SystemAdmin
SystemAdmin
5837 Posts

Pinned topic linux ODBC driver for DB2?

‏2006-03-14T22:39:14Z |
Is there a linux ODBC driver for the current version of DB2? Where can I get it? I need something that works with unixODBC...

Thanks!
Updated on 2006-03-27T22:35:35Z at 2006-03-27T22:35:35Z by SystemAdmin
  • rfchong
    rfchong
    484 Posts

    Re: linux ODBC driver for DB2?

    ‏2006-03-15T02:24:36Z  
    Hi,

    The ODBC Driver (also known as CLI driver) comes with DB2 Express-C, and also any of the DB2 Clients. This driver should work fine with UnixODBC.

    Regards,

    Raul F. Chong
    IBM DB2 UDB Express Community Facilitator
    Email: db2x@ca.ibm.com
  • SystemAdmin
    SystemAdmin
    5837 Posts

    Re: linux ODBC driver for DB2?

    ‏2006-03-15T16:45:35Z  
    • rfchong
    • ‏2006-03-15T02:24:36Z
    Hi,

    The ODBC Driver (also known as CLI driver) comes with DB2 Express-C, and also any of the DB2 Clients. This driver should work fine with UnixODBC.

    Regards,

    Raul F. Chong
    IBM DB2 UDB Express Community Facilitator
    Email: db2x@ca.ibm.com
    > The ODBC Driver (also known as CLI driver) comes with
    > DB2 Express-C, and also any of the DB2 Clients. This
    > driver should work fine with UnixODBC.

    I looked there, but the custom install doesn't seem to mention the ODBC driver and I'm not too interested in installing the entire product. all I want is the ODBC driver.

    I also tried looking in the DB2 Personal Developer's Edition (as per this advice: http://www.unixodbc.org/doc/db2.html), but it doesn't mention the ODBC driver in the custom install either. I went ahead and installed that anyway and found the libdb2.so file (mentioned at the same url as previous), but there is no setup file. It seems like the url I found must be for an older version of unixODBC that doesn't require setup files? Or maybe I'm using the config tools incorrectly?

    Does anyone have more details on how to do this?

    Thanks...
  • SystemAdmin
    SystemAdmin
    5837 Posts

    Re: linux ODBC driver for DB2?

    ‏2006-03-15T16:45:48Z  
    • rfchong
    • ‏2006-03-15T02:24:36Z
    Hi,

    The ODBC Driver (also known as CLI driver) comes with DB2 Express-C, and also any of the DB2 Clients. This driver should work fine with UnixODBC.

    Regards,

    Raul F. Chong
    IBM DB2 UDB Express Community Facilitator
    Email: db2x@ca.ibm.com
    > The ODBC Driver (also known as CLI driver) comes with
    > DB2 Express-C, and also any of the DB2 Clients. This
    > driver should work fine with UnixODBC.

    I looked there, but the custom install doesn't seem to mention the ODBC driver and I'm not too interested in installing the entire product. all I want is the ODBC driver.

    I also tried looking in the DB2 Personal Developer's Edition (as per this advice: http://www.unixodbc.org/doc/db2.html), but it doesn't mention the ODBC driver in the custom install either. I went ahead and installed that anyway and found the libdb2.so file (mentioned at the same url as previous), but there is no setup file. It seems like the url I found must be for an older version of unixODBC that doesn't require setup files? Or maybe I'm using the config tools incorrectly?

    Does anyone have more details on how to do this?

    Thanks...
  • rfchong
    rfchong
    484 Posts

    Re: linux ODBC driver for DB2?

    ‏2006-03-15T22:28:52Z  
    > The ODBC Driver (also known as CLI driver) comes with
    > DB2 Express-C, and also any of the DB2 Clients. This
    > driver should work fine with UnixODBC.

    I looked there, but the custom install doesn't seem to mention the ODBC driver and I'm not too interested in installing the entire product. all I want is the ODBC driver.

    I also tried looking in the DB2 Personal Developer's Edition (as per this advice: http://www.unixodbc.org/doc/db2.html), but it doesn't mention the ODBC driver in the custom install either. I went ahead and installed that anyway and found the libdb2.so file (mentioned at the same url as previous), but there is no setup file. It seems like the url I found must be for an older version of unixODBC that doesn't require setup files? Or maybe I'm using the config tools incorrectly?

    Does anyone have more details on how to do this?

    Thanks...
    Hi,

    The DB2 CLI driver acts as an ODBC driver when loaded by an ODBC driver manager. To obtain the CLI driver, download and install any of the DB2 clients (the runtime client is the smallest one). You can get it from:

    http://www-306.ibm.com/software/data/db2/udb/support/downloadv8.html

    I don't recall if there is a choice to just install the CLI driver, you may need to install the entire DB2 client.

    With respect to setup with unixODBC, there's some information here:
    http://publib.boulder.ibm.com/infocenter/db2luw/v8//topic/com.ibm.db2.udb.doc/ad/r0010416.htm?

    And this may also help:
    http://www-128.ibm.com/developerworks/db2/library/techarticle/dm-0401chong/index.html#scenario1

    Good luck,

    Raul F. Chong
    IBM DB2 UDB Express Community Facilitator
    Email: db2x@ca.ibm.com
  • SystemAdmin
    SystemAdmin
    5837 Posts

    Re: linux ODBC driver for DB2?

    ‏2006-03-16T17:48:02Z  
    • rfchong
    • ‏2006-03-15T22:28:52Z
    Hi,

    The DB2 CLI driver acts as an ODBC driver when loaded by an ODBC driver manager. To obtain the CLI driver, download and install any of the DB2 clients (the runtime client is the smallest one). You can get it from:

    http://www-306.ibm.com/software/data/db2/udb/support/downloadv8.html

    I don't recall if there is a choice to just install the CLI driver, you may need to install the entire DB2 client.

    With respect to setup with unixODBC, there's some information here:
    http://publib.boulder.ibm.com/infocenter/db2luw/v8//topic/com.ibm.db2.udb.doc/ad/r0010416.htm?

    And this may also help:
    http://www-128.ibm.com/developerworks/db2/library/techarticle/dm-0401chong/index.html#scenario1

    Good luck,

    Raul F. Chong
    IBM DB2 UDB Express Community Facilitator
    Email: db2x@ca.ibm.com
    > http://www-306.ibm.com/software/data/db2/udb/support/d
    > ownloadv8.html
    > With respect to setup with unixODBC, there's some
    > information here:
    > http://publib.boulder.ibm.com/infocenter/db2luw/v8//to
    > pic/com.ibm.db2.udb.doc/ad/r0010416.htm?

    Gr. This is frustrating.

    I installed the client. Is there some configuration of the client that I need to do? The documentation makes it seem like the ODBC driver will only work if you point it at a configuration instance (i.e. /home/db2inst1), but the ODBC config only gives enough information to know where that instance is, not where my actual database sits (which is on another server). It looks like they want me to use the configuration assistant, which is db2ca on a unix system, but db2ca doesn't exist anywhere in the newly installed /opt/IBM or /home/db2inst1. How does this driver know where the database is?

    "Normal" unixODBC drivers have a setup file, along with the driver. It appears as those this setup file, in conjunction with ODBCConfig, is used to tell unixODBC various parameters, such as server location.

    This Page:

    http://www.unixodbc.org/drivers.html

    says the iSeries Access for Linux has an ODBC driver, which I installed. This client seems to at least be in a recognizeable format, with a driver lib and a setup lib, but it seems like maybe this driver is outdated, or something is missing because no matter what configuration I use, it tells me the server isn't listening for incoming connections. But maybe it is only using some subset of ODBC that the iSeries understands...

    Help?
  • rfchong
    rfchong
    484 Posts

    Re: linux ODBC driver for DB2?

    ‏2006-03-16T21:09:14Z  
    > http://www-306.ibm.com/software/data/db2/udb/support/d
    > ownloadv8.html
    > With respect to setup with unixODBC, there's some
    > information here:
    > http://publib.boulder.ibm.com/infocenter/db2luw/v8//to
    > pic/com.ibm.db2.udb.doc/ad/r0010416.htm?

    Gr. This is frustrating.

    I installed the client. Is there some configuration of the client that I need to do? The documentation makes it seem like the ODBC driver will only work if you point it at a configuration instance (i.e. /home/db2inst1), but the ODBC config only gives enough information to know where that instance is, not where my actual database sits (which is on another server). It looks like they want me to use the configuration assistant, which is db2ca on a unix system, but db2ca doesn't exist anywhere in the newly installed /opt/IBM or /home/db2inst1. How does this driver know where the database is?

    "Normal" unixODBC drivers have a setup file, along with the driver. It appears as those this setup file, in conjunction with ODBCConfig, is used to tell unixODBC various parameters, such as server location.

    This Page:

    http://www.unixodbc.org/drivers.html

    says the iSeries Access for Linux has an ODBC driver, which I installed. This client seems to at least be in a recognizeable format, with a driver lib and a setup lib, but it seems like maybe this driver is outdated, or something is missing because no matter what configuration I use, it tells me the server isn't listening for incoming connections. But maybe it is only using some subset of ODBC that the iSeries understands...

    Help?
    Hello,

    First of all, you mentioned iSeries Access for Linux. I went to the site:
    http://www.unixodbc.org/drivers.html

    and then found:
    http://www-03.ibm.com/servers/eserver/iseries/access/linux/

    Where it says:

    ============
    iSeries Access for Linux is the latest offering in the iSeries Access product line. iSeries Access for Linux allows you to access the DB2 Universal Database® (UDB) for iSeries using its ODBC Driver and to establish a 5250 session to an iSeries server from a Linux client.
    ============

    This forum is for DB2 Express-C, and the driver mentioned in the above quote is not something we support in this forum, as it is a driver created for DB2 iSeries by DB2 iseries people.

    With DB2 Express (not DB2 Express-C) we normally allow access to DB2 for iSeries by purchasing a software called "DB2 Connect". Then you can use the DB2 Express CLI driver as the ODBC driver. DB2 Express-C does not include support to connect to the iSeries, so you first need to upgrade to DB2 Express, and also purchase DB2 Connect. In my earlier responses, I was assuming you were dealing only with DB2 Linux/Windows servers.

    For help with the driver mentioned in the above quote, you may click on the support link on that iSeries page (Here's the direct link: http://www-03.ibm.com/servers/eserver/iseries/access/linux/support.html )

    Regards,

    Raul F. Chong
    IBM DB2 UDB Express Community Facilitator
    Email: db2x@ca.ibm.com
  • SystemAdmin
    SystemAdmin
    5837 Posts

    Re: linux ODBC driver for DB2?

    ‏2006-03-17T19:52:51Z  
    • rfchong
    • ‏2006-03-16T21:09:14Z
    Hello,

    First of all, you mentioned iSeries Access for Linux. I went to the site:
    http://www.unixodbc.org/drivers.html

    and then found:
    http://www-03.ibm.com/servers/eserver/iseries/access/linux/

    Where it says:

    ============
    iSeries Access for Linux is the latest offering in the iSeries Access product line. iSeries Access for Linux allows you to access the DB2 Universal Database® (UDB) for iSeries using its ODBC Driver and to establish a 5250 session to an iSeries server from a Linux client.
    ============

    This forum is for DB2 Express-C, and the driver mentioned in the above quote is not something we support in this forum, as it is a driver created for DB2 iSeries by DB2 iseries people.

    With DB2 Express (not DB2 Express-C) we normally allow access to DB2 for iSeries by purchasing a software called "DB2 Connect". Then you can use the DB2 Express CLI driver as the ODBC driver. DB2 Express-C does not include support to connect to the iSeries, so you first need to upgrade to DB2 Express, and also purchase DB2 Connect. In my earlier responses, I was assuming you were dealing only with DB2 Linux/Windows servers.

    For help with the driver mentioned in the above quote, you may click on the support link on that iSeries page (Here's the direct link: http://www-03.ibm.com/servers/eserver/iseries/access/linux/support.html )

    Regards,

    Raul F. Chong
    IBM DB2 UDB Express Community Facilitator
    Email: db2x@ca.ibm.com
    > and also purchase DB2 Connect. In my earlier
    > responses, I was assuming you were dealing only with
    > DB2 Linux/Windows servers.

    Sorry, didn't mean to confuse the issue by referencing that iSeries driver. It's just that the unixODBC maintainers seem to be referencing that driver as a possible way to connect to DB2 in general, so I thought it might be worth a shot.

    To confirm, I am running DB2 Express-C on Windows and trying to connect via unixODBC on linux.

    With all of the various clients and servers, I am now totally confused as to what needs to happen to make this work. It seems to not follow "normal" unixODBC proceedures at all.
  • SystemAdmin
    SystemAdmin
    5837 Posts

    Re: linux ODBC driver for DB2?

    ‏2006-03-17T20:30:43Z  
    • rfchong
    • ‏2006-03-16T21:09:14Z
    Hello,

    First of all, you mentioned iSeries Access for Linux. I went to the site:
    http://www.unixodbc.org/drivers.html

    and then found:
    http://www-03.ibm.com/servers/eserver/iseries/access/linux/

    Where it says:

    ============
    iSeries Access for Linux is the latest offering in the iSeries Access product line. iSeries Access for Linux allows you to access the DB2 Universal Database® (UDB) for iSeries using its ODBC Driver and to establish a 5250 session to an iSeries server from a Linux client.
    ============

    This forum is for DB2 Express-C, and the driver mentioned in the above quote is not something we support in this forum, as it is a driver created for DB2 iSeries by DB2 iseries people.

    With DB2 Express (not DB2 Express-C) we normally allow access to DB2 for iSeries by purchasing a software called "DB2 Connect". Then you can use the DB2 Express CLI driver as the ODBC driver. DB2 Express-C does not include support to connect to the iSeries, so you first need to upgrade to DB2 Express, and also purchase DB2 Connect. In my earlier responses, I was assuming you were dealing only with DB2 Linux/Windows servers.

    For help with the driver mentioned in the above quote, you may click on the support link on that iSeries page (Here's the direct link: http://www-03.ibm.com/servers/eserver/iseries/access/linux/support.html )

    Regards,

    Raul F. Chong
    IBM DB2 UDB Express Community Facilitator
    Email: db2x@ca.ibm.com
    I think I sort of found progress when I found this post on google groups:

    "On the client system login as db2inst1 and run db2
    Inside the db2 system shell run these commands

    CATALOG TCPIP NODE sample REMOTE serverip SERVER portnumber
    CATALOG DATABASE sample AT NODE sample

    Where sample is the name of the database on the server, the alias for it and
    the DSN name on the client side, serverip is the TCP/IP address for the
    server, and portnumber is 500000 the default port number for the DB2
    server. "

    This got me to a point where I can use the odbctest program that comes with unixODBC to do a "full connect" with a "successful" result. Sounds promising!

    However, the server process I am trying to get to connect to the ODBC instance, seems to be having issues still. I think it is because to get odbctest to work I have to set the DB2INST environment variable, and I'm not sure how to do that for a service that runs out of xinetd...
  • rfchong
    rfchong
    484 Posts

    Re: linux ODBC driver for DB2?

    ‏2006-03-17T21:23:33Z  
    I think I sort of found progress when I found this post on google groups:

    "On the client system login as db2inst1 and run db2
    Inside the db2 system shell run these commands

    CATALOG TCPIP NODE sample REMOTE serverip SERVER portnumber
    CATALOG DATABASE sample AT NODE sample

    Where sample is the name of the database on the server, the alias for it and
    the DSN name on the client side, serverip is the TCP/IP address for the
    server, and portnumber is 500000 the default port number for the DB2
    server. "

    This got me to a point where I can use the odbctest program that comes with unixODBC to do a "full connect" with a "successful" result. Sounds promising!

    However, the server process I am trying to get to connect to the ODBC instance, seems to be having issues still. I think it is because to get odbctest to work I have to set the DB2INST environment variable, and I'm not sure how to do that for a service that runs out of xinetd...
    Hi,

    The DB2 ODBC driver (a.k.a CLI driver) will look in the DB2 directories for information about connectivity. The catalog commands you provided in your posting, update these directories. You need to follow the instructions as shown in this article:

    http://www-128.ibm.com/developerworks/db2/library/techarticle/0301chong/0301chong2.html#section1

    In the above link with instructions, you will see an IP address (or hostname) and port are provided. It is the port that tells the client which instance to access. On the server side, to specify the port the instance is listening to, issue:
    db2 update dbm cfg using svcename {port #}

    Please review the article for details.

    This other article I had provided earlier also shows how an ODBC and CLI application can connect to a DB2 Server (though it doesn't involve unixODBC driver manager):
    http://www-128.ibm.com/developerworks/db2/library/techarticle/dm-0401chong/index.html#scenario1

    Hope this helps =)

    Raul F. Chong
    IBM DB2 UDB Express Community Facilitator
    Email: db2x@ca.ibm.com
  • SystemAdmin
    SystemAdmin
    5837 Posts

    Re: linux ODBC driver for DB2?

    ‏2006-03-20T21:57:35Z  
    • rfchong
    • ‏2006-03-17T21:23:33Z
    Hi,

    The DB2 ODBC driver (a.k.a CLI driver) will look in the DB2 directories for information about connectivity. The catalog commands you provided in your posting, update these directories. You need to follow the instructions as shown in this article:

    http://www-128.ibm.com/developerworks/db2/library/techarticle/0301chong/0301chong2.html#section1

    In the above link with instructions, you will see an IP address (or hostname) and port are provided. It is the port that tells the client which instance to access. On the server side, to specify the port the instance is listening to, issue:
    db2 update dbm cfg using svcename {port #}

    Please review the article for details.

    This other article I had provided earlier also shows how an ODBC and CLI application can connect to a DB2 Server (though it doesn't involve unixODBC driver manager):
    http://www-128.ibm.com/developerworks/db2/library/techarticle/dm-0401chong/index.html#scenario1

    Hope this helps =)

    Raul F. Chong
    IBM DB2 UDB Express Community Facilitator
    Email: db2x@ca.ibm.com
    > The DB2 ODBC driver (a.k.a CLI driver) will look in
    > the DB2 directories for information about
    > connectivity.

    Herein lies the problem. When I am logged on to the client machine with shell access, I have to set an environment variable (DB2INSTANCE) that tells the ODBC driver where the DB2 directories are located. My server app runs in the background and doesn't really have a means to set those environment variables, as far as I can tell.

    Look at my error messages to see what I mean:

    root@p3036208 root# db2 connect to test user fred
    SQL10007N Message "-1390" could not be retrieved. Reason code: "3".
    root@p3036208 root# export DB2INSTANCE=db2inst1
    root@p3036208 root# db2 connect to test user fred
    Enter current password for fred:

    Database Connection Information

    Database server = DB2/NT 8.2.4
    SQL authorization ID = FRED
    Local database alias = TEST

    > This other article I had provided earlier also shows
    > how an ODBC and CLI application can connect to a DB2
    > Server (though it doesn't involve unixODBC driver
    > manager):
    > http://www-128.ibm.com/developerworks/db2/library/tech
    > article/dm-0401chong/index.html#scenario1

    Scenario 2 is actual more similar to what I am trying to do, since I am not writing code, just trying to get an existing software application to connect to a DB2 ODBC datasource (it's supposed to work with ANY ODBC data source, so I may have to go with a different database engine if I can't get DB2 to work). Anyway, part 2 of scenario 2 says I should use the db2 command to list and register the ODBC data source. However, that command gives me the following output:

    root@p3036208 root# db2 list system odbc data sources
    SQL1297N This command is currently not supported on this platform.
    root@p3036208 root# db2 catalog system odbc data source test
    SQL1297N This command is currently not supported on this platform.

    However, scenario 2 specifically says:

    "Starting with DB2 UDB V8, however, IBM officially supports the open source unixODBC Driver manager."

    Still getting nowhere...
  • rfchong
    rfchong
    484 Posts

    Re: linux ODBC driver for DB2?

    ‏2006-03-20T23:28:29Z  
    > The DB2 ODBC driver (a.k.a CLI driver) will look in
    > the DB2 directories for information about
    > connectivity.

    Herein lies the problem. When I am logged on to the client machine with shell access, I have to set an environment variable (DB2INSTANCE) that tells the ODBC driver where the DB2 directories are located. My server app runs in the background and doesn't really have a means to set those environment variables, as far as I can tell.

    Look at my error messages to see what I mean:

    root@p3036208 root# db2 connect to test user fred
    SQL10007N Message "-1390" could not be retrieved. Reason code: "3".
    root@p3036208 root# export DB2INSTANCE=db2inst1
    root@p3036208 root# db2 connect to test user fred
    Enter current password for fred:

    Database Connection Information

    Database server = DB2/NT 8.2.4
    SQL authorization ID = FRED
    Local database alias = TEST

    > This other article I had provided earlier also shows
    > how an ODBC and CLI application can connect to a DB2
    > Server (though it doesn't involve unixODBC driver
    > manager):
    > http://www-128.ibm.com/developerworks/db2/library/tech
    > article/dm-0401chong/index.html#scenario1

    Scenario 2 is actual more similar to what I am trying to do, since I am not writing code, just trying to get an existing software application to connect to a DB2 ODBC datasource (it's supposed to work with ANY ODBC data source, so I may have to go with a different database engine if I can't get DB2 to work). Anyway, part 2 of scenario 2 says I should use the db2 command to list and register the ODBC data source. However, that command gives me the following output:

    root@p3036208 root# db2 list system odbc data sources
    SQL1297N This command is currently not supported on this platform.
    root@p3036208 root# db2 catalog system odbc data source test
    SQL1297N This command is currently not supported on this platform.

    However, scenario 2 specifically says:

    "Starting with DB2 UDB V8, however, IBM officially supports the open source unixODBC Driver manager."

    Still getting nowhere...
    Hello,

    The article provided was written testing on Windows, so some of the commands like "db2 list system odbc data sources" will not work from a Linux client.

    If you can modify the connection string of that 3rd party vendor program, you can try a DSN-less connection, which should not look at those DB2 directories. You can use this syntax in your code:

    Const ConnectionString =
    "UID=your_username;PWD=your_password;database=your_db;HOSTNAME=your_hostname;protocol=TCPIP;servicename=server_instance_portnumber>;driver={IBM DB2 ODBC DRIVER};"

    Where:
    UID = username
    PWD = password
    HOSTNAME = IP address or hostname of server
    SERVICENAME = port number that is listed in SVCENAME dbm cfg on the server

    If that doesn't work, try to set the following parameters in the db2cli.ini file:

    COMMON
    Protocol = TCPIP
    Hostname = your server's hostname or IP address
    ServiceName = port number listed in SVCENAME dbm cfg on the server
    Database = Database name as defined on the server
    UID = username
    PWD = password

    Ensure there are NO connections against your database, and your application is not connected (Issue a db2stop/db2start if possible); and then try to connect again.

    The db2cli.ini file is located in the sqllib directory on Window platforms, and in the sqllib/cfg directory of the instance running the CLI/ODBC applications on Linux.

    Hope this helps,

    Raul F. Chong
    IBM DB2 UDB Express Community Facilitator
    Email: db2x@ca.ibm.com
  • SystemAdmin
    SystemAdmin
    5837 Posts

    Re: linux ODBC driver for DB2?

    ‏2006-03-22T22:11:35Z  
    • rfchong
    • ‏2006-03-20T23:28:29Z
    Hello,

    The article provided was written testing on Windows, so some of the commands like "db2 list system odbc data sources" will not work from a Linux client.

    If you can modify the connection string of that 3rd party vendor program, you can try a DSN-less connection, which should not look at those DB2 directories. You can use this syntax in your code:

    Const ConnectionString =
    "UID=your_username;PWD=your_password;database=your_db;HOSTNAME=your_hostname;protocol=TCPIP;servicename=server_instance_portnumber>;driver={IBM DB2 ODBC DRIVER};"

    Where:
    UID = username
    PWD = password
    HOSTNAME = IP address or hostname of server
    SERVICENAME = port number that is listed in SVCENAME dbm cfg on the server

    If that doesn't work, try to set the following parameters in the db2cli.ini file:

    COMMON
    Protocol = TCPIP
    Hostname = your server's hostname or IP address
    ServiceName = port number listed in SVCENAME dbm cfg on the server
    Database = Database name as defined on the server
    UID = username
    PWD = password

    Ensure there are NO connections against your database, and your application is not connected (Issue a db2stop/db2start if possible); and then try to connect again.

    The db2cli.ini file is located in the sqllib directory on Window platforms, and in the sqllib/cfg directory of the instance running the CLI/ODBC applications on Linux.

    Hope this helps,

    Raul F. Chong
    IBM DB2 UDB Express Community Facilitator
    Email: db2x@ca.ibm.com
    > The article provided was written testing on Windows,
    > so some of the commands like "db2 list system odbc
    > data sources" will not work from a Linux client.

    They should make this more clear in the documentation then, because saying that linux is supported and showing command line commands right after makes it seem like it should work.

    > If you can modify the connection string of that 3rd
    > party vendor program, you can try a DSN-less
    > connection, which should not look at those DB2
    > directories. You can use this syntax in your code:

    I already said that this is third party. I have absolutely no interest in modifying source code. This is why I am investigating ODBC in the first place. Having to modify source code to make an ODBC connection pretty much defeats the point of using ODBC.

    > If that doesn't work, try to set the following
    > parameters in the db2cli.ini file:
    >
    > COMMON
    > Protocol = TCPIP
    > Hostname = your server's hostname or IP address
    > ServiceName = port number listed in SVCENAME dbm cfg
    > on the server
    > Database = Database name as defined on the server
    > UID = username
    > PWD = password

    I tried this, plus added a few environment variables as per various bits of reading here and there and now the app complains of a bad password, even though the username and password is the same everywhere that it appears. Why would the command:

    db2 connect to test user s188253

    work, while the same username and password in the app don't? It seems the app is passing the arguments properly, because if I remove the username and password from the app's config file, the error message changes to one that says "missing username/password".

    Again, I must ask, why in the world does IBM claim compatibility with unixODBC when the method of utilizing it is COMPLETELY different than a "typical" unixODBC configuration? Jumping through hoops like this is a nightmare.
  • rfchong
    rfchong
    484 Posts

    Re: linux ODBC driver for DB2?

    ‏2006-03-22T23:04:05Z  
    > The article provided was written testing on Windows,
    > so some of the commands like "db2 list system odbc
    > data sources" will not work from a Linux client.

    They should make this more clear in the documentation then, because saying that linux is supported and showing command line commands right after makes it seem like it should work.

    > If you can modify the connection string of that 3rd
    > party vendor program, you can try a DSN-less
    > connection, which should not look at those DB2
    > directories. You can use this syntax in your code:

    I already said that this is third party. I have absolutely no interest in modifying source code. This is why I am investigating ODBC in the first place. Having to modify source code to make an ODBC connection pretty much defeats the point of using ODBC.

    > If that doesn't work, try to set the following
    > parameters in the db2cli.ini file:
    >
    > COMMON
    > Protocol = TCPIP
    > Hostname = your server's hostname or IP address
    > ServiceName = port number listed in SVCENAME dbm cfg
    > on the server
    > Database = Database name as defined on the server
    > UID = username
    > PWD = password

    I tried this, plus added a few environment variables as per various bits of reading here and there and now the app complains of a bad password, even though the username and password is the same everywhere that it appears. Why would the command:

    db2 connect to test user s188253

    work, while the same username and password in the app don't? It seems the app is passing the arguments properly, because if I remove the username and password from the app's config file, the error message changes to one that says "missing username/password".

    Again, I must ask, why in the world does IBM claim compatibility with unixODBC when the method of utilizing it is COMPLETELY different than a "typical" unixODBC configuration? Jumping through hoops like this is a nightmare.
    Hi,

    Sorry to hear this is still not working for you. I will provide your feedback to the people who write the DB2 manuals.

    I'd suggest turning on a CLI trace to see exactly what is being passed by that application to the server. Turn it on by adding the following in the COMMON stanza of the db2cli.ini file:


    TraceComm=1
    Trace=1
    TracePathName=C:\temp
    TraceFlush=1

    Note: For TracePathName use /tmp/trace instead of C:\temp for Linux systems. Ensure the C:\temp or /tmp/trace directories exist and can be written to. If this is a Linux platform, please make sure the directory has rwx permissions)

    Restart your CLI/ODBC application, and test the connection again. Then check in the C:\temp (or the path you specified in the TracePathName keyword), for the trace files generated, and look in these files for the connection string. At least you should be able to see if the userId is correct. Let me know exactly what keywords you have set in the db2cli.ini after getting this trace.

    Regards,

    Raul F. Chong
    IBM DB2 UDB Express Community Facilitator
    Email: db2x@ca.ibm.com
  • SystemAdmin
    SystemAdmin
    5837 Posts

    Re: linux ODBC driver for DB2?

    ‏2006-03-27T22:35:35Z  
    • rfchong
    • ‏2006-03-22T23:04:05Z
    Hi,

    Sorry to hear this is still not working for you. I will provide your feedback to the people who write the DB2 manuals.

    I'd suggest turning on a CLI trace to see exactly what is being passed by that application to the server. Turn it on by adding the following in the COMMON stanza of the db2cli.ini file:


    TraceComm=1
    Trace=1
    TracePathName=C:\temp
    TraceFlush=1

    Note: For TracePathName use /tmp/trace instead of C:\temp for Linux systems. Ensure the C:\temp or /tmp/trace directories exist and can be written to. If this is a Linux platform, please make sure the directory has rwx permissions)

    Restart your CLI/ODBC application, and test the connection again. Then check in the C:\temp (or the path you specified in the TracePathName keyword), for the trace files generated, and look in these files for the connection string. At least you should be able to see if the userId is correct. Let me know exactly what keywords you have set in the db2cli.ini after getting this trace.

    Regards,

    Raul F. Chong
    IBM DB2 UDB Express Community Facilitator
    Email: db2x@ca.ibm.com
    I installed MS SQL Server Express on the windows box and freetds from freetds.org in conjunction with unixODBC on the linux box and got it working in a few hours. Microsoft's documentation isn't much better than IBM's, but freetds and unixodbc have lots of easy to read and find documentation.

    DB2-Express-C has a better license than the Microsoft SQL Server Express license, but it doesn't help if you can't get it to work.

    Before starting this project, I was relatively new at ODBC, MS SQL Server, and DB2. In my opinion, DB2 actually has too much documentation, because there are numerous places the specific thing you are looking for MIGHT be. A little consolidation would be good. Also, bundling a DB2 client with everything seems to have muddied the water on where to find the appropriate client. Granted, Microsoft doesn't even support a linux ODBC client for their server (which is why I went with DB2 to begin with), but the community seems to support Microsoft better than IBM.