这是我第一次使用Derby数据库,而且我在使用Netbeans服务连接数据库时遇到了麻烦。
这是我的数据库连接代码:
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);
}
}
我一直在寻找答案,但我不能像我一样得到确切的关注。 请帮忙。谢谢!