This blog post mainly introduces how to connect to the DB2 database by using Visual Studio,
Of course, you can use components such as IBM. Data. DB2,
Then concatenate a connection string to access the DB2 database,
However, if you are using Visual Studio as a development tool, there are actually more convenient operations,
This is the plug-in provided by IBM for accessing DB2 in Visual Studio installed on Visual Studio,
IBM database add-ins for Visual Studio
Let's first look at the combination of my environment,
Visual Studio team System 2008,
DB2-Express-C-9.7 (IBM official website has a next, completely free, learning to use, is definitely enough)
The following is the plug-in provided by IBM.
Https://www14.software.ibm.com/webapp/iwm/web/reg/download.do?
Source = SWG-daivs & s_pkg = DL & lang = en_us & CP = UTF-8 & dlmethod = http
This plug-in is only 32 m, which is an executable file of. EXE, so it is OK to directly install it,
For the two installation procedures,
After the installation is complete, open Visual Studio 2008,
On the loading page of Vs, you can see an additional IBM plug-in item,
Then you can add a connection to DB2 through "server resource manager,
Note that the above "User ID" and "password" are not the user name and password of your DB2 database,
It is the username and password of the server where your DB2 database is located,
For example, my DB2 is installed on my own machine, that is, the local machine,
Then, my user name is the user name and password when I log on to the operating system,
Obviously, the OS user I have logged on to has passed the operating system verification,
So in fact,I can connect to DB2 without specifying the user name and password.
(Use the default login server user ),
In fact, you can click "advanced" to view the connection details,
After the connection is added, you can directly use the database resources specified by DB2 in "server resource manager,