• 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).

      IBM DB2
    • Defining the connection pooling pool size

      Server=myAddress:myPortNumber;Database=myDataBase;UID=myUsername;PWD=myPassword;
      Max Pool Size
      =100;Min Pool Size=10;
      IBM DB2
    • Disable connection pooling

      Server=myAddress:myPortNumber;Database=myDataBase;UID=myUsername;PWD=myPassword;
      Pooling
      =false;
      IBM DB2
    • 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.

      IBM DB2
    • Connection pooling, do not pool

      Server=myAddress:myPortNumber;Database=myDataBase;UID=myUsername;PWD=myPassword;
      Connection Reset
      =false;
      IBM DB2
    • 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

      IBM DB2

    Problems connecting?   Get answer in the IBM DB2 Q & A forum →

  • IBM OLE DB Provider for DB2

    • TCP/IP

      Provider=IBMDADB2;Database=myDataBase;Hostname=myServerAddress;Protocol=TCPIP;
      Port
      =50000;Uid=myUsername;Pwd=myPassword;
      IBM DB2
  • 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;
      IBM DB2
    • 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
  • .NET Framework Data Provider for OLE DB

    • Use an OLE DB provider from .NET

      Provider=any oledb provider's name;OledbKey1=someValue;OledbKey2=someValue;

      See the respective OLEDB provider's connection strings options. The .net OleDbConnection will just pass on the connection string to the specified OLEDB provider. Read more here.

  • 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;
      IBM DB2
    • Database Alias

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

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

      IBM DB2
    • 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"

      IBM DB2
  • .NET Framework Data Provider for ODBC

    • Use an ODBC driver from .NET

      Driver={any odbc driver's name};OdbcKey1=someValue;OdbcKey2=someValue;

      See the respective ODBC driver's connection strings options. The .net OdbcConnection will just pass on the connection string to the specified ODBC driver. Read more here.

Articlesread all

Didn't find your connection string?

Start over from the connection string reference index - or try a search!

In the Q&A forums you can ask your own question and let somebody help you.

The knowledge articles contains solutions and guides.