db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stanley Bradbury <Stan.Bradb...@gmail.com>
Subject Re: Embedded mode: multiple connection & read-only Db
Date Thu, 13 Sep 2007 03:11:42 GMT
Lu, Chris (NIH/NLM/LHC) [C] wrote:
>
> Dear Sir:
>
>  
>
> I run into Derby last week and found it is very nice and easy to use. 
> Especially with embedded mode makes it easy for software need to be 
> distributed. However there are two features that I can’t found in Derby:
>
>  
>
> 1). Multiple users (connections)
>
> Multiple connections are only provided for embedded Derby Server (not 
> the pure embedded mode, org.apache.derby.EmbeddedDriver). Please 
> correct me if I am wrong.
>
>  
>
> 2). Read-only
>
> Derby provide a way for running on read-only media. However, does not 
> provide a flag to set the database to
>
> read-only. In our application, we store all data in the database and 
> don’t expect/want the end users to modify it after we distribute the 
> software.
>
>  
>
> Currently, we are using Hyper-Sonic SQL database. HSqlDb is also 
> developed in 100% Java and don’t provide multiple connection for 
> embedded mode with R-W mode. However, multiple connections are allowed 
> when the flag of  “read-only” is set to “true” in the embedded mode. 
> Very nice and useful feature.
>
>  
>
> Just wondering if Derby plan to provide the same features in the near 
> future. Thank you very much and have a nice day!
>
>  
>
> n       Chris, Ph.D.
>
> n       Sr. Systems Architect
>
> n       Lockheed Martin/MSD/NLM/NIH
>
>  
>
>  
>
>  
>
Hi Chris -
 Regarding 1:  I've talked to many people familiar with Client Server 
databases who read that
'embedded Derby can only be accessed from within a single JVM' and take 
this as meaning it is single user.  This is not true.  You can establish 
as many connections as you wish from within the same Java program/JVM 
environment.  It is multi-threaded and locking prevents connections from 
stepping on each other.  Please see my attempt to address this confusion 
in the section " Is embedded Derby a multiuser database?" at:
http://www.ibm.com/developerworks/db2/library/techarticle/dm-0408bradbury/#cs_multi 
<http://db.apache.org/derby/derby_downloads.html>

Regarding 2: The easiest way would be to place the database in a 
jarfile.  Jarfiles are read-only even when deployed to read-write 
media.  Accessing databases in a jar require use of special connection URL.
Another way to implement read only is to enable auththentication and 
only give the users the access information to the read-only account(s).  
This works when the database is implemented in any architecture.  You 
will want to define the required properties as database properties in 
the same manner as described in the section "What are the steps needed 
to implement user authentication and authorization " at: 
http://www.ibm.com/developerworks/db2/library/techarticle/dm-0408bradbury/#cs_authenticate


   Granted this is not as easy as flipping a switch or jaring up a DB 
but eliminates the possibility that someone unjars the database or 
unflips the switch.
 
Hope this helps



Mime
View raw message