我尝试连接到我的 BD
这是我的代码
public class JavaSQLTest {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
try {
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
String connectionUrl = "jdbc:sqlserver://FRANK-PC\\SQLEXPRESS" +
"databaseName=Pendu;";
Connection con = DriverManager.getConnection(connectionUrl);
} catch (SQLException e) {
System.out.println("SQL Exception: "+ e.toString());
} catch (ClassNotFoundException cE) {
System.out.println("Class Not Found Exception: "+ cE.toString());
}
}
}
运行后出现 Class Not Found Exception: java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver...
如何在sql服务器上正确连接???
谢谢弗兰克
你必须把SQL Server JDBC 驱动程序 http://msdn.microsoft.com/en-us/sqlserver/aa937724库到类路径中。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)