Return-Path: Delivered-To: apmail-db-derby-user-archive@www.apache.org Received: (qmail 43620 invoked from network); 31 Mar 2008 08:13:07 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 31 Mar 2008 08:13:07 -0000 Received: (qmail 78297 invoked by uid 500); 31 Mar 2008 08:13:05 -0000 Delivered-To: apmail-db-derby-user-archive@db.apache.org Received: (qmail 78278 invoked by uid 500); 31 Mar 2008 08:13:05 -0000 Mailing-List: contact derby-user-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Reply-To: "Derby Discussion" Delivered-To: mailing list derby-user@db.apache.org Received: (qmail 78256 invoked by uid 99); 31 Mar 2008 08:13:05 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 31 Mar 2008 01:13:04 -0700 X-ASF-Spam-Status: No, hits=-1.0 required=10.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [192.18.43.25] (HELO sca-ea-mail-2.sun.com) (192.18.43.25) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 31 Mar 2008 08:12:11 +0000 Received: from dm-uk-02.uk.sun.com ([129.156.101.196]) by sca-ea-mail-2.sun.com (8.13.7+Sun/8.12.9) with ESMTP id m2V8CUbO012749 for ; Mon, 31 Mar 2008 08:12:30 GMT Received: from barman.uk.sun.com (barman.UK.Sun.COM [129.156.132.12]) by dm-uk-02.uk.sun.com (8.13.7+Sun/8.13.7/ENSMAIL,v2.2) with ESMTP id m2V8CTrq000248 for ; Mon, 31 Mar 2008 09:12:29 +0100 (BST) Received: from vpn-129-150-121-28.uk.sun.com ([129.150.121.28]) by barman.uk.sun.com with esmtp (Exim 4.42) id 1JgF7n-0005xl-Ui for derby-user@db.apache.org; Mon, 31 Mar 2008 09:12:16 +0100 Message-ID: <47F09CEC.7060309@sun.com> Date: Mon, 31 Mar 2008 09:12:28 +0100 From: Alan Burlison User-Agent: Thunderbird 2.0.0.9 (X11/20080213) MIME-Version: 1.0 To: Derby Discussion Subject: Re: how to start database server from w/in java code References: <00BB008AA995A046824528C48825FCF30AE5ECA9@EXVBE012-4.exch012.intermedia.net> In-Reply-To: <00BB008AA995A046824528C48825FCF30AE5ECA9@EXVBE012-4.exch012.intermedia.net> Content-Type: text/plain; charset=windows-1250; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Checked: Checked by ClamAV on apache.org 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. See http://auth.opensolaris.org/svn/showfile.svn?path=%2ftrunk%2fAuthDb%2fsrc%2forg%2fopensolaris%2fauth%2fdb%2fDbManager.java&revision=HEAD&name=auth ---------- This class wraps the Derby 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: DbMode.EMBEDDED The database runs embedded within the invoking JVM and is not externally accessible DbMode.SERVER_EMBEDDED The database runs within the invoking JVM as a network server and is externally accessible while the host JVM is running. DbMode.SERVER_DAEMON 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_DB_SQL Configure the database, e.g. create users and schemas, set permissions. CREATE_DB_SQL Create the database tables and indexes. POPULATE_DB_SQL Load any default values into the tables. ---------- -- Alan Burlison --