The second method is now introduced, and the corresponding driver provided by the manufacturer is now connected.
This implementation method is to directly use the driver created by the dedicated network protocol provided by the database vendor, which can directly convert JDBC API calls to direct network calls. This method of calling is generally better, and it is also the simplest method in practical. Because it needs to install other libraries or middleware. Almost all database vendors provide this database for their database to provide this JDBC driver or from third-party vendors.
From the URL http://industry.java.sun.com/products/jdbc/drivers/ You can see the list of all useful drivers. The result is as shown in the figure:
Application - JDBC API --- Driver --- Data Source
Here first, you must install the JDBC driver, recommend SP2 version, you can download http://www.microsoft.com/downloads/details.aspx?familyid=9f1874b6-f8e1-4bf71&displaylang=EN download The bottom setup.exe
This driver is to cooperate with SQL Server2000 SP3A, and download the URL for http://www.microsoft.com/china/sql/downloads/sp3.asp CHS_SQL2Ksp3.exe
If you use Java SDK, you need to set the environment variable, set the LIB three files in the installed JDBC driver to environment variables: ClassPath: D: / Program Files / Microsoft SQL Server / JDBC / LIB / MSBASE.jar; D: / Program Files / Microsoft SQL Server / JDBC / LIB / MSSQLServer.jar; D: / Program Files / Microsoft SQL Server / JDBC / LIB / MSUTIL.JAR;
The installation can be connected to the database with Microsoft drivers, and the corresponding code is basically the same as the previous:
Import java.sql. *; import java.io. *; public class dbcolumn {