db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alan Burlison <Alan.Burli...@sun.com>
Subject Re: Fwd: [nbusers] netbeans 6.0 RC1 SQLSyntaxException: table/view does not exist
Date Thu, 22 Nov 2007 10:31:50 GMT
David Van Couvering wrote:

> It sure would be great if somebody wrote up a tutorial or blog or
> whatever describing the different ways to initialize an embedded
> database for the first time (e.g. using JDBC, JPA, or by including a
> "starting" database in your JAR file that you copy over...)

No tutorial, but some working code:

http://src.opensolaris.org/source/xref/website/auth/trunk/AuthDB/src/org/opensolaris/auth/db/DbManager.java

This runs inside Tomcat and creates a new database the first time it is 
run, subsequent runs use the existing database.  The database runs in 
embedded server mode, so whilst Tomcat is running you can access it 
externally as well.

The database is initialised via SQL script files that are contained in 
the application WAR file, using the ij utility (derbytools.jar).  ij can 
be run from inside an application as well as from the command-line, and 
ij + SQL scripts is the easiest way I've found so far of setting up a 
database, because the SQL scripts can be debugged from the command-line 
before being embedded in the app.

-- 
Alan Burlison
--

Mime
View raw message