Complete installation and testing of the SQL Server 2000 JDBC driver

Source: Internet
Author: User
This is a document I organized during my graduation project at Changsha Niuer Software Education Center. Recently, some of my students asked me how I finally pulled it out. The database in it is the project database we used at the time. You can modify it based on your own database. Of course, other materials also need to be modified based on your actual situation.

1. Download The JDBC driver of sqlserver2000Program.

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/3/0/f/30ff65d3-a84b-4b8a-a570-27366b2271d8/setup.exe

 

Unix OS mssqlserver.tar

Http://download.microsoft.com/download/3/0/f/30ff65d3-a84b-4b8a-a570-27366b2271d8/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) ms_jdbc_setup default installation path: C: \ Program Files \ Microsoft SQL Server 2000 driver for JDBC

(2) 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: You can also copy the above three files to the java_home \ JRE \ Lib \ ext directory where your JVM machine is located, but it is not recommended to do so.

 

Iv. Test

JSP file:

 

 

Class. forname ("com. Microsoft. JDBC. sqlserver. sqlserverdriver"). newinstance ();

String url = "JDBC: Microsoft: SQL SERVER: // localhost: 1433; databasename = haiguan ";

String user = "sa ";

String Password = "";

Connection conn = drivermanager. getconnection (URL, user, password );

Statement stmt = conn. createstatement (resultset. type_scroll_sensitive, resultset. concur_updatable );

String SQL = "select * From xt_user ";

Resultset rs1_stmt.exe cutequery (SQL );

While (Rs. Next ())

{

%>

The content of your first field is:

Your second field content is:

}

%>

Rs. Close ();

Stmt. Close ();

Conn. Close ();

%>

 

 

 

5. Notes

1. Make sure that your SQL service is in the 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. Note the startup sequence of JVM and Database: Start the database first and then the JVM machine.

Note: After you stop the Web server and restart it, you are advised 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. Some machines should be able to change the connection address localhost in (4) to the IP address of the database server during debugging. This is also the reason for note 5.

Related Article

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.