I have a derby database that is deployed along with my webapp to WEB-INF/classes/myDb
What should my jdbc.connection url be to connect so that I can write to the database?
I am trying
jdbc:derby:myDb;
and it can not find the database. I need to be able to modify the database. If i put classpath:myDb, it finds it, but it is unfortunately read only per the derby docs.
i solved it by setting my jdbc connection url at runtime and using:
StringBuilder derbyUrl = new StringBuilder("jdbc:derby:");
derbyUrl.append(servletContext.getRealPath("/"));
derbyUrl.append("/WEB-INF/classes/myDb;");
dataSource.setUrl(derbyUrl.toString());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With