有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java无法创建嵌入式Derby DB

我无法创建Derby嵌入式数据库。我已经尝试了文档中的所有内容

同样的错误

The database directory 'C:\blah\blah' exists. However, it does not contain the expected 'service.properties' file. Perhaps Derby was brought down in the middle of creating this database. You may want to delete this directory and try creating the database again

我试过:

Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance();
Connection conn = DriverManager.getConnection("jdbc:derby:"+dbPath + ";create=true");

它不起作用

我尝试设置derby路径:

 System.setProperty("derby.system.home", dbPath);

它不起作用

我尝试访问嵌入式数据源,同样

private Connection createDB(String path) throws SQLException, NamingException{
    Connection conn = null;
    EmbeddedConnectionPoolDataSource ds = new EmbeddedConnectionPoolDataSource();
    ds.setDatabaseName(path);
    ds.setCreateDatabase("create");
    conn = ds.getConnection();
    return conn;
}

看在上帝的份上,我做错了什么

不,我不想把服务。属性,此后日志文件夹的问题开始出现


共 (0) 个答案