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: how to start database server from w/in java code
Date Mon, 31 Mar 2008 08:12:28 GMT
Brandon Dohman wrote:

> I’m going to be deploying a java desktop app, and I am curious on how to start the
database server from within the code.  I have done all of my testing through netbeans, and
have been able to get all of the connections and transactions to go smoothly, but the database
was started by using the tools > javadb > start db server option in netbeans.
> With deployment, I’ll need to be able to start the code from within my java code.


This class wraps the <a href="http://db.apache.org/derby/">Derby</a> 
database so that it is easy to start Derby and create a new database. 
It can be used to run Derby in one of three modes:

The database runs embedded within the invoking JVM and is not externally 

The database runs within the invoking JVM as a network server and is 
externally accessible while the host JVM is running.

The database runs in a separate JVM as a network server and is 
externally accessible.  If the JVM that started the server exits, the 
Derby server will continue to run unless it is explicitly shut down.

In all the above cases, if the database does not exist when Derby is 
started, it will be created.  During creation the following three SQL 
scripts will be executed to create and populate the database, all held 
in the /sql directory in the library JAR file:

Configure the database, e.g. create users and schemas, set permissions.

Create the database tables and indexes.

Load any default values into the tables.

Alan Burlison

View raw message