JAVA连接SQL server 2000 的问题 (急!!!)
用以下代码连接SQL server 2000出错
import
java.sql.SQLException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.Statement;
import java.sql.ResultSet;
//import java.*;
public class CourseAppl {
private Connection conn;
private String url;
private String serverName;
private String portNumber;
private String databaseName;
private String userName;
private String password;
private String sql;
CourseAppl() {
url = "jdbc:microsoft:sqlserver:// ";
serverName = "127.0.0.1 ";
portNumber = "1433 ";
databaseName = "master ";
userName = " ";
password = " ";
}
private String getConnectionUrl() {
//System.out.println (url + serverName + ": "
// + portNumber + ";databaseName= "
//+ databaseName + "; ");
return url + serverName + ": "
+ portNumber + ";databaseName= "
+ databaseName + "; ";
}
private Connection getConnection() {
try {
System.out.println (getConnectionUrl());
Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver ");
//Class.forName( "com.microsoft.sqlserver.jdbc.SQLServerDrive ");