Connect to a DB2 Database

I am unable to establish a connection to DB2 Database. I have used Microsoft ODBC Data Source (ODBC) and my connection string is as follow
ConnectionString = Driver={IBM DB2 ODBC DRIVER};DataBase=DataBaseName;HostName=ServerName;Protocol=TCPIP;Port=PortNumber;Uid=UserName;Pwd=Secret;";

Please let me know what I am doing wrong

Create DSN and use this connection string “Driver={IBM DB2 ODBC DRIVER};dbalias=DataBaseName;uid=YourUID;pwd=YourPassword”. It will work.

image

Hi @senthilngt,

I am trying to create DSN but encountering below error,

DB2_Error

Could you please help!!!

Reg,
Sarthak

Instance owner group is not same as system admin group.

Check this below link.

Receiving "SQL1390C The environment variable DB2INSTANCE is not defined or is invalid." on db2start.

Hi @senthilngt,

Thanks for your reply!!

Could please suggest any solution, I am able to connect with the same DB2 instance via DBvisualizer.

Reg,
Sarthak