The ODBC .NET Data Provider makes ODBC calls to a DB2® data source using the CLI Driver. Therefore, the connection string keywords supported by the ODBC .NET Data Provider are the same as those supported by the CLI driver. This provider is no longer tested. Users are recommended to use the IBM® Data Server Provider for .NET.
Also, the ODBC .NET Data Provider has the same restrictions as the CLI driver. There are additional restrictions for the ODBC .NET Data Provider, which are identified in the topic: ODBC .NET Data Provider restrictions.
In order to use the ODBC .NET Data Provider, you must have the .NET Framework Version 2.0, 3.0, or 3.5 installed. For DB2 Universal Database™ for AS/400® V5R4 and earlier, the following fix is required on the server: APAR II13348.
Keyword | Value | Meaning |
---|---|---|
DSN | database alias | The DB2 database alias as cataloged in the database directory |
UID | user ID | The user ID used to connect to the DB2 server |
PWD | password | The password for the user ID used to connect to the DB2 server |
[Visual Basic .NET]
Dim con As New OdbcConnection("DSN=sample;UID=userid;PWD=password;")
con.Open()
[C#]
OdbcConnection con = new OdbcConnection("DSN=sample;UID=userid;PWD=password;");
con.Open()