db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Dudziak <tom...@gmail.com>
Subject Re: Why are classpath databases always read-only ?
Date Thu, 08 Dec 2005 16:26:47 GMT
On 12/8/05, Daniel John Debrunner <djd@debrunners.com> wrote:
> Thomas Dudziak wrote:
>
> > the manual says
> > (http://db.apache.org/derby/docs/10.1/devguide/rdevdvlp38881.html):
> >
> > "classpath   Databases are treated as read-only databases, and all
> > databaseNames must begin with at least a slash, because you specify
> > them "relative" to the classpath directory."
> >
> > Now I wonder why that is so ? Is there a particular reason to treat
> > these always as read-only ? If the classpath points to a local
> > directory (as opposed to, say, a jar), Derby could easily resolve this
> > to a real path and work with this.
>
> Only because no-one has asked for this feature and maybe at the time I
> didn't realise you could get to the real path from the resource. When
> this feature was added Cloudscape was running on JDK 1.1 where the
> getURL method was not available.

Would you consider adding it ? I think that is would be really useful
because it would decouple the app from where it runs (without having
to run Derby in server mode).

> > This would allow web applications to be created with an initial,
> > embedded Derby database without having to hard-code the absolute
> > database path (no assumption can be made as to where the current
> > working directory is when running in a servlet container, so the path
> > must be absolute).
>
> Also, you can package a read-only database in a jar file and archive
> that in the web-application archive, war or ear file. Then one can
> distribute read-only data with web-applications and access that data
> without ever unpacking the war/ear file and not knowing its location on
> disk.

Sure, but that is exactly the point: the database is read-only. If I
want to have an embedded database (e.g. co-located to the web app,
say, in WEB-INF/classes/derbydb) then I have to use a jdbc directory
url with an absoulte path which kind of defeats the concept of WARs.
Or I have to determine the JDBC url at runtime as a workaround, but
that IMHO is ugly.

regards,
Tom

Mime
View raw message