I am using Win 2k and using VC .net (DB2 CLI library) to connect to database. I am currently connecting to server through DSN and it is working fine, but I don't want to make DSN to connect. Instead, I want to use connection string to connect to the database. I gave the following connection string: -

"driver={IBM DB2 ODBC DRIVER};Database=sample;hostname=;port= 50000;protocol=TCPIP;uid=db2admin;pwd=click123"

I am connecting to database named "sample" on server whose IP is Username/Password are db2admin/click123. It is giving the following error message: -

"[IBM][CLI Driver] SQL30082N Attempt to establish connection failed with security reason "24" ("USERNAME AND/OR PASSWORD INVALID"). SQLSTATE=08001"

I think 50000 is the default port on which it listens. I have tried changing the port number, but then it gives errors like "Communication could not be established". The username/password works fine when I use it to make DSN in control panel and when I use it on server.

Can anyone tell me why is it giving such message? I'll be really grateful.


- Khaliq