Non-SQL Server databases such as IBM DB2, which are accessed in Visual Studio.NET beta version 1, typically use the ODBC method of Ado.net, while in Beta 2 the database is accessed using OLE DB methods instead.
The connection string in BETA1 is primarily required to declare the ODBC DNS name of the database, but the string of OLE DB connections in Beta 2 is more complex and the classes used are not the same. Because the database such as DB2 is used widely in the application of mainframe. NET will naturally support this kind of programming development, and for this, the DB2 development of OLE DB will be elaborated in the following step.
OLE DB for DB2 driver
First, the DB2 OLE DB driver is not directly available in Visual Studio.NET and Windows Server, so download the Microsoft Host Integration Server 2000 software, which contains OLE DB Provider and ODBC driver for DB2, download the server-side package and choose to install the data integration at installation time, and you can use its OLE DB DB2 drive when the installation is complete.
Setting up a database connection
First, we need to configure the DB2 client settings, open the Server Explorer in the View Select item, add a connection to its data connection, select Microsoft OLE DB Provider for DB2 when specifying the program options, and complete the following information in the next connection option:
Data source:qcdb (please change as appropriate)
Network:tcp/ip
IP Address: Database server addresses
Network PORT:DB2 Service Port
Username: User name for database access rights
Password: This user password
Database Initial CATALOG:QCDB
Package collection:qcdb
Default Schema:userid
The next advanced option is to select the corresponding code page and CCSID in the respective national languages, and finally press the confirm key to complete the connection.
Suppose qcdb This DB2 database has a new data table for address, it contains four fields: name, email, age, and address, we can use Server Explorer to open the connection and the data table, and enter a number of Chinese records to determine whether the characters are displayed correctly.