SQLSERVER2000 JDBC driver's full installation and test instructions
Author: shiyq Date: 2003.06.2
Special explanation: When writing this article, I specially refer to some of the essences and experiences of online netizens in SQLServer2000 JDBC.
First, download the JDBC driver of SQLServer2000.
There is this driver in Microsoft Site:
WINDOW operating system
http://www.uncj.com/upload/files/ms_jdbc_setup.exe
Http://download.microsoft.com/download/sqlsvr2000/jdbc/2000/nt45xp/en-us/setup.exe
UNIX operating system MSSQLServer.tar
http://download.microsoft.com/download/sqlsvr2000/jdbc/2000/unix/EN-US/MssqlServer.tar
Second, install JDBC
Execute the MS_JDBC_SETUP.EXE executable, everything just click Next, until the Finish button appears, complete the installation.
Note:
(1) MS_JDBC_SETUP default installation path is:
C: / Program Files / Microsoft SQL Server 2000 Driver for JDBC
(2) This version (Version 2.2.0022) is only supported
Microsoft SQL Server 2000 Driver for JDBC
(3) The three JAR files under the installation directory / lib / below is the JDBC driver core we want.
Msbase.jar
MSSQLServer.jar
Msutil.jar
Third, add three JAR files in the above (3) to the environment variable
Classpath:
D: /webserver/lib/msbase.jar
D: /webserver/lib/msqlserver.jar
D: /webserver/lib/msutil.jar
Note: I recommend copying the above three files to the lib or class directory where your JVM is located. At this point, I copied it to the LIB under my JVM directory.
Fourth, test
Public class test {
Public test () {}
Public static void main (string args []) {
Try {
Class.Forname ("com.microsoft.jdbc.sqlser.sqlserverdriver);
Connection conn
= DriverManager.getConnection ("JDBC: Microsoft: SQLServer: // localhost: 1433; user = sa; password =; databasename = maxwell");
Statement Stmt = conn.createstatement ();
String SQL = "SELECT * from Employee";
ResultSet RS = Stmt.executeQuery (SQL);
While (rs.next ()) {
System.out.println ("Testname:" rs.getstring ("name");
}
Rs.close ();
Stmt.close ();
CONN.CLOSE ();
} catch (exception ex) {system.err.println (ex.getMessage ());}
}
}
V. Precautions
1. To ensure your SQL service is started
2. You can log in normally in SQL or other users; (Some people use NT user management mode when installing SQL, there may be a problem here) 3. The first configuration environment variable is best Restart the computer
4. Note the startup sequence of JVM and Database:
Start Database first, start the JVM machine;
Note: After stopping the web server, restart, it is best to have intervals of more than 10 seconds.
5. Pay attention to the network connectivity of the operating system
A. Start TCP / IP service
B. Configure the associated IP address, some people can use it automatically assign IP or configure IP, but the network is not possible to find IP
6. Some machines are in debugging that it is best to change the connection address localhost in (4) to the IP of the database server, which is also the reason for 5.