从 Microsoft.NET 连接到 DB2

  1. IBM DB2 UDB 8.1.2(需要安装服务器版的 DB2)
    DB2Connection cn = new DB2Connection(
    "Database=TEST;UserID=db2admin; Password=password;Server=IS500");
    DB2Command cmd = new DB2Command("SELECT COUNT(*) FROM EMP01", cn);
    int count = Convert.ToInt32(cmd.ExecuteScalar());
  2. Microsoft Host Integration Server 2006
    试用下载地址:https://thesource.ofallevil.com/taiwan/hiserver/evaluation/trial/default.mspx
  3. DataDirect Connect for .NET, Edition 2.0 http://www.ddtek.com/products/dotnet/dotnetrelhigh.asp (DataDirect)
  4. Mono.Data.DB2Client http://www.go-mono.com/ibmdb2.html (Mono)
链接字符串:

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=MyUser;Password=MyPW"

APPC

"Provider=DB2OLEDB;APPC Local LU Alias=MyAlias;APPC Remote LU Alias =MyRemote;Initial Catalog=MyCtlg;Package Collection=MyPkgCol;Default Schema=Schema;UserID=MyUser;Password=MyPW"