Unable to create embedded Derby DB

I just can't seem to create an embedded Derby database. I tried everything in the documentation

Same error

The database directory is 'C: \ blah \ blah'. However, it does not contain the expected "service.properties" file. Derby may have been hit in the middle of creating this database. You can delete this directory and try to create the database again

I tried:

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

      

He did not work

I tried to set the derby path:

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

      

He did not work

I tried to access the embedded data source, the same ...

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;
}

      

For God's sake, what am I doing wrong?

And no, I don't want to put the service.properties in the folder, as then the log folder problem starts

+3


source to share





All Articles