Return-Path: Delivered-To: apmail-db-derby-user-archive@www.apache.org Received: (qmail 38905 invoked from network); 30 Sep 2004 23:52:26 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 30 Sep 2004 23:52:26 -0000 Received: (qmail 15399 invoked by uid 500); 30 Sep 2004 23:52:25 -0000 Delivered-To: apmail-db-derby-user-archive@db.apache.org Received: (qmail 15266 invoked by uid 500); 30 Sep 2004 23:52:24 -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 15255 invoked by uid 99); 30 Sep 2004 23:52:24 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from [204.146.167.214] (HELO Boron.MeepZor.Com) (204.146.167.214) by apache.org (qpsmtpd/0.28) with ESMTP; Thu, 30 Sep 2004 16:52:23 -0700 Received: from [9.30.40.123] (dmz-firewall [206.199.198.4]) by Boron.MeepZor.Com (8.11.6/8.11.6) with ESMTP id i8UNqMv10932 for ; Thu, 30 Sep 2004 19:52:23 -0400 Message-ID: <415C9B79.8000300@Source-Zone.org> Date: Thu, 30 Sep 2004 16:49:13 -0700 From: Suresh Thalamati Reply-To: tsuresh@Source-Zone.org User-Agent: Mozilla Thunderbird 0.7.3 (Windows/20040803) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Derby Discussion Subject: Re: Speeding up unit tests that need a clean database? References: In-Reply-To: X-Enigmail-Version: 0.85.0.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Hi I don't think Derby has CREATE/DROP database statements. Derby has support for backup/restore. One way to simulate DROP/CREATE in test scripts is to restore/create (URL properties : restoreFrom and createFrom) an empty database from a backup after each test. Backup will take some time, but I guess in your test environment that is going to be only one time overhead. ij scriipt: ---create a new database connect 'jdbc:derby:wombat;create=true'; ---take database backup before doing anything else call SYSCS_UTIL.SYSCS_BACKUP_DATABASE('ext/mybackup'); connect 'jdbc:derby:wombat;shutdown=true'; connect 'jdbc:derby:wombat;restoreFrom=ext/mybackup/wombat'; You should be able to make above call through JDBC based java program.. Thanks -suresh Nyenyec N wrote: >Hi, > >I have several JUnit tests that I run as part of the builds and also >from inside the Eclipse IDE. >So far my app uses SQL Server and HSQLDB. In both cases I found a way >to quickly create a clean database (with no tables) use it and discard >it after each test. > >In SQL Server I use the CREATE/DROP DATABASE call, in HSQLDB I simply >use an in-memory instance. Creating and discarding a database takes >about 2 secs in SQL Server and 1 sec in HSQLDB. > >In Derby however, connecting to a URL like this >"jdbc:derby:temp/testdb;create=true" >takes about 20 secs on the same machine (P4, 1Gb mem). >Is there a way to do this quicker or approximate the behavior >described above in some other way? > >Thanks, >Nyenyec > > >