[unixODBC-support] Huge problems connecting to a DB2 database.

Nicklas Börjesson Nicklas.Borjesson at ws.se
Sun Sep 19 00:19:27 BST 2010

>-----Original Message-----
>From: unixodbc-support-bounces at mailman.unixodbc.org on behalf of Nick Gorham
>Sent: Sat 2010-09-18 20:21
>To: Support for the unixODBC project
>Subject: Re: [unixODBC-support] Huge problems connecting to a DB2 >database.
>  On 18/09/2010 19:05, Nicklas Börjesson wrote:
>> Hi,
>> Well, it works to connect via IBM Data Studio, which (being a plugin to eclipse) uses JDBC.
>> Anyway, it seems like it breaks before connecting. I have tried changing the server to something that doesn't exists, which >did not affect anything.
>> Correct me if I am wrong, but the error message means that it for some reason can't find the DB2 instance definition, doesn't it?
>Wat it means is that the driver manager has loaded the library, 
>extracted the enrty points and called SQLAllocHandle( ENV)  and 
>thatreturns a error.

>You may have said what platform you are on, but do you have anything 
>like strace to see whats going on under the hood, it may be a missing lib.

>I don;t know if it still exists but DB2 used to come with a command line 
>tool db2 that used the same libs as the ODBC driver to connect. I would 
>guess the JDBC driver goes a entirely different path.

>unixODBC-support mailing list
>unixODBC-support at mailman.unixodbc.org

Thanks, and hi again!

The strace doesn't tell much, it mostly reported the writes to sql.log . It has some problems finding its locale, but that shouldn't be fatal, right? Is there something special I should look for, some extra strace option, perhaps?

However, I realised that this was in /tmp/sql.log:

Connection = 0x1fb2810
Server Name = [FS01DB2][length = 7 (SQL_NTS)]
User Name = [NULL]
Authentication = [NULL]
UNICODE Using encoding ASCII 'ISO8859-1' and UNICODE 'UCS-2LE'           

Server name is for some reason the same as the name of the DSN, which is not the same as the server FQDN.
And user name and authentication is null.

As you maybe saw before, I specify username in the DSN.

Maybe my .ini-files have some strange fault in them, after all, I don't know.

Warm regards

Haven't gotten the db2 cli to work at all yet. A somewhat cumbersome utility, it feels like.

More information about the unixODBC-support mailing list