Topic: SQL SERVER2000 连接问题

  Print this page

1.SQL SERVER2000 连接问题 Copy to clipboard
Posted by: gxz224
Posted on: 2006-11-27 17:10

各位大哥大姐:
我是个java初学者,在SQL Server2000上不知道如何解决。
我的操作系统是XP sp2我已安装了SQL Server2000 For JDBC并设置了CLASSPATH:
.;%JAVA_HOME%\lib\tools.jar;%JAVA_HOME%\lib\dt.jar;C:\mssql2000JDBC\lib\msbase.jar;C:\mssql2000JDBC\lib\mssqlserver.jar;C:\mssql2000JDBC\lib\msutil.jar
而且还安装了SQL2000sp3补丁
可是在JCreator中和在cmd中运行程序时出错如图

2.SQL SERVER2000 连接问题(续) [Re: gxz224] Copy to clipboard
Posted by: gxz224
Posted on: 2006-11-27 17:12

代码
import java.sql.*;
public class Test1{
public static void main(String[] args){
try{
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
System.out.println("数据库驱动程序注册成功!");
String url ="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=northwind";
String user = "sa";
String password = "";
Connection conn = DriverManager.getConnection(url, user, password);
System.out.println("数据库连接成功");
}catch(Exception e){
e.printStackTrace();
System.out.println("数据库连接失败");
}
}
}

(缩略图,点击图片链接看原图)

3.Re:SQL SERVER2000 连接问题 [Re: gxz224] Copy to clipboard
Posted by: jc841020245
Posted on: 2006-12-25 00:52

1433端口没有打开你的补丁再按一边
或者数据库从安装把

4.Re:SQL SERVER2000 连接问题 [Re: gxz224] Copy to clipboard
Posted by: gxz224
Posted on: 2006-12-30 00:06

问题决解啦...好开心喔..
原来在JCreator 中配置Cmsbase.jar;mssqlserver.jar和msutil.jar就行了...


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923