java连接到sql server 2008 express [英] java connection to sql server 2008 express
本文介绍了java连接到sql server 2008 express的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试连接到我的BD
这是我的代码
I try to connect to my BD This is my code
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 ....
I get Class Not Found Exception: java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver after running....
如何在sql server上正确连接???
How to connect properly on a sql server ???
谢谢Frank
推荐答案
你必须把 SQL Server JDBC驱动程序库进入类路径。
You have to put the SQL Server JDBC driver library into the classpath .
这篇关于java连接到sql server 2008 express的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文