【问题标题】:java connection to sql server 2008 expressjava连接到sql server 2008 express
【发布时间】:2012-04-21 09:38:20
【问题描述】:

我尝试连接到我的 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 after running....

如何在sql server上正确连接???

谢谢弗兰克

【问题讨论】:

  • 检查这个 stackoverflow question。这正是您所要求的。

标签: java netbeans-7


【解决方案1】:

您必须将SQL Server JDBC driver 库放入类路径中。

【讨论】:

    猜你喜欢
    • 2010-10-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-03-19
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多