java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLSeverDriver
测试代码importjava.sql.*;publicclasstest{publicstaticvoidmain(String[]args){StringdriverN...
测试代码
import java.sql.*;
public class test {
public static void main(String[] args){
String driverName="com.microsoft.sqlserver.jdbc.SQLSeverDriver";
String dbURL="jdbc.sqlserver://localhost:1433;DatabaseName=学生成绩管理系统";
String userName="sa";
String userPwd ="123456";
Connection dbConn;
try{
Class.forName(driverName);
dbConn=DriverManager.getConnection(dbURL,userName,userPwd);
System.out.println("Connection Successful!");}
catch(Exception e){e.printStackTrace();}
}
}
已经引入了sqljdbc4.jar可是还是失败
java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLSeverDriver
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:190)
at 学生管理系统.test.main(test.java:11) 展开
import java.sql.*;
public class test {
public static void main(String[] args){
String driverName="com.microsoft.sqlserver.jdbc.SQLSeverDriver";
String dbURL="jdbc.sqlserver://localhost:1433;DatabaseName=学生成绩管理系统";
String userName="sa";
String userPwd ="123456";
Connection dbConn;
try{
Class.forName(driverName);
dbConn=DriverManager.getConnection(dbURL,userName,userPwd);
System.out.println("Connection Successful!");}
catch(Exception e){e.printStackTrace();}
}
}
已经引入了sqljdbc4.jar可是还是失败
java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLSeverDriver
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:190)
at 学生管理系统.test.main(test.java:11) 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询