db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nicholas Negulescu" <nick.negule...@gmail.com>
Subject Re: How to recover from the DB not existing
Date Sun, 24 Sep 2006 22:57:25 GMT
I was thinking just the other way around. =)

The only time the exception will be thrown is if there is no database. In
the (rare/one-time) event that this is the first time a user has started the
application and the database does not exist, then go and create it from the
bogusdb.sql file -- zero admin. I'm using POJOs, not working with Hibernate
either (yet).

My problem is that I'm trying to figure out how to load it from an SQL file.
Sure, I can do it on the command line like so:

java -Djdbc.drivers=org.apache.derby.jdbc.EmbeddedDriver
org.apache.derby.tools.ij <bogusdb.sql>

but I was wondering which tool/class to use when you've alread got the
driver loaded and you're executing withing the VM already. I see that dblook
has an output (but no input) mechanism:

java org.apache.derby.tools.dblook -d 'jdbc:derby:c:\private\stuff\sample'
-o 'C:\temp\newDB.sql'

But this too is command-line driven. Thanks in advance!



On 9/24/06, Barry Books <trsvax@gmail.com> wrote:
>
> You could always use create=true then load the database if it's not
> loaded. To figure out if it's been loaded you could select your your
> table names to see if they have been created. None of that will
> generate an exception.
>

Mime
View raw message