Search code examples
javanetbeansjavafxderby

Another instance of Derby may have already booted the database using embedded db


I'm using a derby db in my JavaFX app, everything works fine, but when I connect to my db in netbeans to check out some records, and then start my app again, I get this error:

Another instance of Derby may have already booted the database

I disconnect from the db but I still get the exception, it is resolved when I restart my pc.

How can I resolve this?


Solution

  • In embedded mode only one process is allowed to access the Derby database files. If you open the database with netbeans to see what's going on, then your JavaFX application would be the second process accessing the database files in embedded mode. But the files are still open in netbeans.

    During development it is often necessary to view the database contents at the same time your application accesses the database. You can start a Derby Network Server and access the database in client mode instead embedded. Be sure to switch the connection strings for both netbeans and your JavaFX application.

    When you deploy your application you can easily switch back to embedded mode by changing the connection string in your configuration.