db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Francois Orsini <francois.ors...@gmail.com>
Subject Re: DB in temporary directory
Date Sun, 07 Jun 2009 01:02:49 GMT
Hi Kilian,

You might want to use an in-memory DB if you don't need to preserve it
across new instances...

Derby's In-Memory instrumental feature has been added in 10.5.1 which is now
available.

To specify an in-memory DB, just add the 'memory' subprotocol before the
database name, such as:
connect 'jdbc:derby:memory:MyDBNAME;create=true';

Here some blog entry with more info about it:
http://blogs.sun.com/kah/entry/derby_10_5_preview_in

If you still want to create your database in a temp directory, you could do
it such as:
//Unix-like
connect 'jdbc:derby:/tmp/MyDBNAME;create=true';

or

// Windows
connect 'jdbc:derby:C:/temp/MyDBNAME;create=true';

--francois

On Sat, Jun 6, 2009 at 5:36 PM, Kilian Evang <doppelpunkte@texttheater.de>wrote:

> Hi,
>
> I'm trying to create an application that uses a temporary database for
> storing internal data. No data needs to preserved across run-times.
>
> Here's what I'm currently doing to create a temporary database:
>
> ------------------------------------------------------------------------
> connection = DriverManager.getConnection("jdbc:derby:" + tmpFileName +
> ";create=true");
> ------------------------------------------------------------------------
>
> This leads to the creation of a directory in the present working
> directory. I would rather like the file put into the system's temp
> directory, and auto-delete it on exit. How can I do this?
>
> Thanks
> Kilian
>
>

Mime
View raw message