SQLServer2000 JDBC driver connection

xiaoxiao2021-03-06  20

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/sqlsvr2000/jdbc/2000/NT45XP/EN -US / setup.exe

UNIX operating system mssqlser.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) This only supports Microsoft SQL Server 2000 Driver for JDBC (3) Installing Directory / LIB / LIB / LIB / LIB / LIB / LIB / LIB / LIB / LIB / LIB / LIB / LIB / LIB / Under We want JDBC driver core msbase.jar mssqlser.jar Msutil .jar

Third, add the three JAR files in the above (3) to the environment variable to ClassPath: D: /webserver/lib/msbase.jar D: /webserver/lib/mssqlserver.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.sqlserver.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"));}}}} rclose (); stmt.close (); conn.close () ;} catch (exception ex) {system.rr.println (ex.getMessage ());}}

}

V. Precautions

1. To ensure that your SQL service is started 2. Sa or other users can log in in the SQL manager; (Some people use NT user management mode when installing SQL, this may have a problem) 3. It is best to restart the computer at a time, it is best to restart the computer 4. Note JVM and Database start order: start Database, start the JVM machine; Note: After stopping the web server, restart, it is best to have 10 seconds. The above interval. 5. Pay attention to the network connectivity A of the operating system. Start the 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 No IP 6. Some machines are best to change the connection address localhost in (4) to the IP of the database server, which is also the reason for 5. In fact, it is very simple. How do you add a driver method for jBuild9 project to join SQLServer2000: Project-> Propject Properties-> Paths-> Required Libraries Select Add to join JAR and then compile the execution four, test the easiest way: Open Enterprise Setup - Database Drivers, add your JDBC driver, if there is no new one in the menu, there will be more jdbc.config in Database Drivers. Then open the Database Pilot, and you will find that your driver becomes black, indicates that it is available. Connection, you can already operate in Database Pilot.

SQLSERVER2000 JDBC driver's full installation and test instructions Author: shiyq Date: 2003.06.2 Special Description: I specially refer to the essence and experience of some netizens on the online netizens in SQL Server2000 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/sqlsvr2000/jdbc/2000/NT45XP/EN -US / setup.exe

UNIX operating system mssqlser.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) This only supports Microsoft SQL Server 2000 Driver for JDBC (3) Installation Directory / LIB / three JAR files are the JDBC driver core msbase.jar mssqlser.jar msutil.jar

Third, add the three JAR files in the above (3) to the environment variable to ClassPath: D: /webserver/lib/msbase.jar D: /webserver/lib/mssqlserver.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.sqlserver.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"));}}}} rclose (); stmt.close (); conn.close () ;} catch (exception ex) {system.rr.println (ex.getMessage ());}}

}

V. Precautions

1. To ensure that your SQL service is started 2. Sa or other users can log in in the SQL manager; (Some people use NT user management mode when installing SQL, this may have a problem) 3. It is best to restart the computer at a time, it is best to restart the computer 4. Note JVM and Database start order: start Database, start the JVM machine; Note: After stopping the web server, restart, it is best to have 10 seconds. The above interval. 5. Pay attention to the network connectivity A of the operating system. Start the 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 No IP 6. Some machines are best to change the connection address localhost in (4) to the IP of the database server, which is also the reason for 5. ############ 33 The simpler method is to put three M * .jar in the lib / ext of the JRE directory, and ClassPath is not set.

转载请注明原文地址:https://www.9cbs.com/read-60440.html

New Post(0)