无法使用Netbeans中的服务连接到Derby数据库

时间:2016-09-16 05:38:57

标签: java database netbeans derby

这是我第一次使用Derby数据库,而且我在使用Netbeans服务连接数据库时遇到了麻烦。

这是我单击数据库后出现的错误: enter image description here

但是我可以使用代码连接到数据库: enter image description here

这是我的数据库连接代码:

private static final String DRIVER ="org.apache.derby.jdbc.EmbeddedDriver";
static final String JDBC_URL ="jdbc:derby:Sales_Forecast2;createdown=true;";        
public Database_Connection()
{
    try {
        this.con = DriverManager.getConnection(JDBC_URL,"sample","123456");
        try {
        Class.forName(DRIVER);
    } catch (ClassNotFoundException e) {
        System.out.println(e.toString());
    }
        if(this.con != null)
        {
            System.out.println("Connected to database");
        }
    } catch (SQLException ex) {
        Logger.getLogger(Database_Connection.class.getName()).log(Level.SEVERE, null, ex);
    }
}

我一直在寻找答案,但我不能像我一样得到确切的关注。 请帮忙。谢谢!

0 个答案:

没有答案