db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel John Debrunner <...@debrunners.com>
Subject Re: Why are classpath databases always read-only ?
Date Thu, 08 Dec 2005 15:07:44 GMT
Thomas Dudziak wrote:

> Hi,
> 
> 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.

> 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.

Dan.



Mime
View raw message