import java.sql.*;
public class TestSql
{
public static void main(String[] srg)
{
String driverName = "com.microsoft.sqlserver.jdbc.SQLServerDriver ";
String dbURL = "jdbc:sqlserver://localhost:1433; DatabaseName=sample ";
String userName = "sa ";
String userPwd = "85793757 ";
Connection dbConn; try
{
Class.forName(driverName);
dbConn = DriverManager.getConnection(dbURL, userName, userPwd);
System.out.println( "Connection Successful! "); Connection Successful!
}
catch (Exception e) {
e.printStackTrace();
}
} }
发生的错误:java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver
先前看过这方面问题的帖子,都说jdbc的jar包没导入
我导入了还是这个问题
sql2005也能正常启动,用的windows和sql混合方式登陆
TCP/IP端口也改为1433了
实在不知道怎么办了额
public class TestSql
{
public static void main(String[] srg)
{
String driverName = "com.microsoft.sqlserver.jdbc.SQLServerDriver ";
String dbURL = "jdbc:sqlserver://localhost:1433; DatabaseName=sample ";
String userName = "sa ";
String userPwd = "85793757 ";
Connection dbConn; try
{
Class.forName(driverName);
dbConn = DriverManager.getConnection(dbURL, userName, userPwd);
System.out.println( "Connection Successful! "); Connection Successful!
}
catch (Exception e) {
e.printStackTrace();
}
} }
发生的错误:java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver
先前看过这方面问题的帖子,都说jdbc的jar包没导入
我导入了还是这个问题
sql2005也能正常启动,用的windows和sql混合方式登陆
TCP/IP端口也改为1433了
实在不知道怎么办了额
你使用什么开发工具?
"com.microsoft.sqlserver.jdbc.SQLServerDriver "; 去一下空格
"com.microsoft.sqlserver.jdbc.SQLServerDriver"