disappearing databases

View: New views
2 Messages — Rating Filter:   Alert me  

disappearing databases

by jstrunk :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Is there some stupid newbie mistake that can cause your Derby databases to disappear?
I am using the Derby 10.5 plugins in Eclipse 3.5.0 to try to do the exercises in the JDBC Tutorial.
I create the databases in one exercise, then load then in another, then query them in another, etc.  
I have gone through the series several times and always at some point the database I have been
using vanishes.

I did the same exercises with MySQL and didn't have any problems but its been torture with Derby.


Re: disappearing databases

by Bryan Pendleton :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> Is there some stupid newbie mistake that can cause your Derby databases to disappear?

A Derby database is just a filesystem directory, so if you accidentally
remove that directory, you have just removed your database.

Another common source of confusion is to use a relative filesystem name
for a database in your JDBC connection URL, and then change your
current working directory between runs, which causes the relative name
to resolve to a different physical directory, and thus your database
seems to disappear, although in fact it's still present, just in a
different directory than where you're looking.

Lastly, if you're using the brand-new "in-memory" database, then it automatically
disappears when you shut the Derby JVM down.

thanks,

bryan