|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
DB in temporary directoryHi,
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 |
|
|
Re: DB in temporary directoryHi 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@...> wrote: Hi, |
|
|
Re: DB in temporary directoryHi Francois,
On Sat, 2009-06-06 at 18:02 -0700, Francois Orsini wrote: > 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. neat! However, I use the DB mainly to avoid running out of memory, so I think this is not an option for me. > 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'; Thanks a bunch, this worked! ~ Kilian |
| Free embeddable forum powered by Nabble | Forum Help |