db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kristian Waagan <Kristian.Waa...@Sun.COM>
Subject Re: Read Server Created DB with Embedded Driver
Date Wed, 19 May 2010 16:11:06 GMT
On 19.05.10 16:49, nm56 wrote:
> Hi, a little background:
>
> I'm zipping up a Java App along with a derby db that I created using the
> network server.
>
> Is it possible to read a locally or transplanted derby db that was created
> and saved using the network driver by using the embedded driver to read it
> or are they just incompatible as I suspect?
>    

Hi,

You can read a database created by the network server with the embedded 
driver.
As a matter of fact, the Derby network server is using the embedded 
driver internally to access the database.

> If they are incompatible, how can I tell the server the location of the
> database I want to access if it is outside of DERBY_HOME?
>    

I suppose you meant compatible here?
You have a few options, but assuming you want read/write access, you can 
specify the absolute or relative path to the database in the connection URL.
For instance:
  'jdbc:derby:/my/db/dir/db'
  'jdbc:derby:../dbs/mydb'

If you only need read access, you can access the database from a JAR/zip 
or from the classpath. See the manual(s) for details.
If you need throw-away databases, you can either create/copy a new 
database from a backup/master, or you can boot a backup/master into 
memory (non-persisted db) using the in-memory protocol. You can do these 
things either by copying the database directory using you OS tools (cp 
or copy), or you can use the createFrom/restoreFrom connection attributes.


Hope this helps,
-- 
Kristian

> Thanks for any help...
>    


Mime
View raw message