IBM DB2 connection strings

DB2 .NET Data Provider

Standard

Server=myAddress:myPortNumber;Database=myDataBase;UID=myUsername;PWD=myPassword;

The Server key value syntax is a server name / ip address and an optional port number (note the : in between).

Connection pooling, time in pool

Server=myAddress:myPortNumber;Database=myDataBase;UID=myUsername;PWD=myPassword;Connection Lifetime=60;

Defines how many seconds the connection can remain idle in the pool before its removed from the pool.

Specifying schema

Server=myAddress:myPortNumber;Database=myDataBase;UID=myUsername;PWD=myPassword;CurrentSchema=mySchema;

All unqualified SQL objects used with the current connection will be qualified with the provided schema name

Microsoft OLEDB provider for DB2

TCP/IP

Provider=DB2OLEDB;Network Transport Library=TCPIP;Network Address=xxx.xxx.xxx.xxx;Initial Catalog=MyCtlg;Package Collection=MyPkgCol;Default Schema=Schema;User ID=myUsername;Password=myPassword;

APPC

Provider=DB2OLEDB;APPC Local LU Alias=MyAlias;APPC Remote LU Alias=MyRemote;Initial Catalog=MyCtlg;Package Collection=MyPkgCol;Default Schema=Schema;User ID=myUsername;Password=myPassword;

IBM DB2 Driver for ODBC and CLI

Standard

Driver={IBM DB2 ODBC DRIVER};Database=myDataBase;Hostname=myServerAddress;Port=1234;Protocol=TCPIP;Uid=myUsername;Pwd=myPassword;

Database Alias

Driver={IBM DB2 ODBC DRIVER};DBALIAS=DatabaseAlias;Uid=myUsername;Pwd=myPassword;

Try this dbalias alternative if the database keyword does not work.

Specifying schema

Driver={IBM DB2 ODBC DRIVER};Database=myDataBase;Hostname=myServerAddress;Port=1234;Protocol=TCPIP;Uid=myUsername;Pwd=myPassword;CurrentSchema=mySchema;

Using this you can use "select from myTable" instead of "select from mySchema.myTable"