日期:2014-05-18  浏览次数:20757 次

SQL SERVER 2000 的连接问题
import   java.sql.*;

public   class   ConnectionTest
{
public   static   void   main(String[]   args)  
{
System.out.println( "programming   is   running   here! ");
try
{
//   1、Class.forName   能够正确加载;已经把jdbc的三个jar文件添加到classpath中
Class.forName( "com.microsoft.jdbc.sqlserver.SQLServerDriver ");
//   2、DriverManager.getConnection   不知道该怎么填写,后两个字符串倒是知道,但是头一个字符串还是不清楚.高手执教~~
Connection   conn=DriverManager.getConnection( "jdbc:microsoft:sqlserver://localhost:1433;databaseName=netfile ", "gloryediter ", "pcy3860 ");
}
catch(ClassNotFoundException   e)
{
System.out.println( "Not   found   exception!!! ");

}
catch(SQLException   e)
{
System.out.println( "SQLException   is   here!!! ");
}
catch(Exception   e)
{
System.out.println( "Exception   catch ");
}
}
}

------解决方案--------------------
不明白
------解决方案--------------------
具体是什么错误呀?
------解决方案--------------------
Connection con = java.sql.DriverManager.getConnection( "jdbc:microsoft:sqlserver://IP;DatabaseName=数据库名字 ", "user ", "password ");
------解决方案--------------------
Class.forName( "com.microsoft.jdbc.sqlserver.SQLServerDriver ");
Connection conn=DriverManager.getConnection( "jdbc:microsoft:sqlserver://localhost:1433;databaseName=数据库名, "sa ", "sa ");//sa 是默认的

------解决方案--------------------
把错误发出来