java连接sql server 2000

介绍java连接sql server2000,步骤:

1,安装sql 2000的sp4补丁,补丁下载地址:

http://www.namipan.com/d/0bcdc477809ee08d747213b3998ee3e1ffac0541546a2a04

注意安装后一定要执行里面的setup.exe继续安装

查看sql 2000是否升级好,可以再查询分析器里看 帮助 里的 关于

ref:http://zhidao.baidu.com/question/89719381.html

2,安装java连接sql2000 的jdbc驱动,下载地址:

http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=07287b11-0502-461a-b138-2aa54bfdc03a#filelist

或者:

http://www.namipan.com/d/14a032ab241f7164a922f9965670f357afb0d214c1142100

3,把lib下的三个jar文件拷到项目的lib目录下

4,建立连接类:

package com.award.bean;

import java.sql.*;  
public class ConnectSqlServer {
public static void main(String[] args) { 
String driverName = "com.microsoft.jdbc.sqlserver.SQLServerDriver";  
String dbURL = "jdbc:microsoft:sqlserver://localhost:1433; DatabaseName=award";
String userName = "sa"; 
String userPwd = "riskfitfeng";
Connection dbConn;  
try { 
Class.forName(driverName);  
dbConn = DriverManager.getConnection(dbURL, userName, userPwd); 
System.out.println("Connection Successful!"); 
}catch(Exception e) {  
e.printStackTrace(); 
}
} 
}


注意修改数据库名和密码

5,运行程序,看是否连接上

ref:

http://blog.csdn.net/snier/archive/2008/11/05/3228166.aspx

你可能感兴趣的:(SQL Server 2000)