db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel John Debrunner <...@apache.org>
Subject Re: creating a database from my application, best practice
Date Mon, 23 Jan 2006 18:41:16 GMT
Manjula G Kutty wrote:

> You can write all your SQL statements in a sql file and just pass that
> sql file name as a string in your application. I think your application
> is in java, then you can pass the file name like this
> org.apache.derby.tools.ij.main(new String[ ] {"-fr", "schema.sql"});

One clarification, the -fr flag gets the file as a resource, thus the
file must be in the classpath, e.g. as an entry in the jar of your
application. If you put the file in a top-level scripts directory then
the correct name would be


or if you put it in a package hierarchy then the name would be something


One minor issue with this is that, at least in embedded mode, ij will
shut Derby down once the script is complete. This is not a huge problem
since the engine is easily started by creating an instances of the JDBC
driver again. It would be nice to add a command line option here to
defeat the shutting down, or maybe a specific method on ij that took ran
a script given an existing connection.


View raw message