Complete installation of sqlserver2000 JDBC driver)

Source: Internet
Author: User
Tags mssqlserver
Complete installation and test description of sqlserver2000 JDBC driver
Author: shiyq Date: 2003.06.2
Note: When I wrote this article, I specifically referred to some online users for the essence and experience in sqlserver2000 JDBC.

1. Download The JDBC driver of sqlserver2000.
This driver is available at the 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 OS mssqlserver.tar
Http://download.microsoft.com/download/SQLSVR2000/jdbc/2000/UNIX/EN-US/mssqlserver.tar

Ii. Install JDBC

Execute the ms_jdbc_setup.exe executable file. You only need to click Next to finish to complete the installation.

Note:
(1) The default installation path of ms_jdbc_setup is:
C:/program files/Microsoft SQL Server 2000 driver for JDBC

(2) This version (version 2.2.0022) only supports
Microsoft SQL Server 2000 driver for JDBC
(3) The Three jar files under the installation directory/lib/are the core of the JDBC driver.
Msbase. Jar
MSSQLServer. Jar
Msutil. Jar

3. Add the Three jar files mentioned in (3) to the environment variables.
Classpath:
D:/webserver/lib/msbase. Jar
D:/webserver/lib/MSSQLServer. Jar
D:/webserver/lib/msutil. Jar

Note: We recommend that you copy the above three files to the lib or class directory of your JVM machine. At this time, I copied it to lib under my JVM directory.

Iv. 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.exe cutequery (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 ());}
}

}

5. Notes

1. Make sure that your SQL service is in startup status
2. log on to the SQL Manager using sa or other users. (Some users use the NT user management mode when installing SQL. Some problems may occur here)
3. You 'd better restart your computer After configuring environment variables for the first time.
4. Pay attention to the startup sequence of JVM and database:
Start the database and then the JVM machine;
Note: After you stop the Web server and restart it, it is best to have an interval of more than 10 seconds in the middle.
5. Pay attention to the network connectivity of the operating system.
A. the TCP/IP service is started.
B. Related IP addresses are configured. Some machines may use an automatically assigned IP address or an IP address, but the IP address may not be found when the network is disconnected.
6. In debugging, it is best for some machines to change the connection address localhost in (4) to the IP address of the database server, which is also the cause of attention 5.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.