Six Fried Rice wrote:
Rick:
Thank you very much for your responses. I have a few followup
questions below:
On Apr 15, 2008, at 1:03 PM, Rick Hillegas wrote:
Please take a look at the section titled "Accessing a read-only
database in a zip/jar file" in the Derby Developer's Guide:
http://db.apache.org/derby/docs/10.3/devguide/ The jars can live
anywhere in the file system or on the classpath.
Ok, super. I had read that information, but I wasn't sure if that
applied to embedded derby, or also to the derby network server. Can I
connect to a derby server and then target a jar file at an arbitrary
location? Also, does this perform reasonably well? My jars will be
between 5 and 50 MB. Of course I will do testing as well. Just
gathering info before I start writing the server-side code.
Hi Geoff,
Other than an extra prefix on the connection URL, the network server
case shouldn't be any different from the embedded case. Just for
reference, the network server itself is simply an application that
embeds the Derby engine. Network or not, you should be able to connect
to any database on the machine which is running the Derby engine. You
may have difficulty connecting to databases that are on machines other
than the engine's host. Please see the section titled "Conventions for
specifying the database path" in the Derby Developer's Guide. I don't
know what the performance comparison is between a read-only database
inside a jar file and a read-only database unpacked on the local file
system.
Derby has no heuristic for knowing where to look for databases. I
think that database discovery has to be done by your application.
Basically, you need to locate the database via a JDBC connection URL.
I'm thinking about derby network server here again. My understanding
is that I launch the server with a DERBY_HOME and it knows about
databases as named directories inside this home. Is that correct?
Right. If the connection URL does not specify an absolute path to the
database, then the database spec is taken to be a path relative to
DERBY_HOME. Please see the following section in the Derby Developer's
Guide: "Database connection examples".
Can you connect to a derby server and then connect to a database at
any filesystem path?
Provided that the filespec is on a disk on the machine where the Derby
engine runs.
And if things do need to be in DERBY_HOME, can I just copy or symlink
a directory to this location at the file system level, then use JDBC
to connect to the database by name?
Yes, Derby will find your database even if you indirect through a symlink.
As Bryan said, please let us know what your experiments show. This
information may be helpful to other Derby users.
Hope this helps,
-Rick
Thanks!
Geoff