You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Lu, Chris (NIH/NLM/LHC) [C]" <ch...@mail.nih.gov> on 2007/09/12 21:48:37 UTC

Embedded mode: multiple connection & read-only Db

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!

 

*       Chris, Ph.D.

*       Sr. Systems Architect

*       Lockheed Martin/MSD/NLM/NIH

 

 

 

 

 

 


Re: Embedded mode: multiple connection & read-only Db

Posted by Mamta Satoor <ms...@gmail.com>.
Hello Chris,

JDBC provides a way to mark the JDBC connections as read-only using *
java.sql.Connection.setReadOnly. *But this probably won't help your
particular software configuration because it relies on the Connection getter
to call the api to mark the Connection as read-only.

Mamta

On 9/12/07, Lu, Chris (NIH/NLM/LHC) [C] <ch...@mail.nih.gov> 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
>
>
>
>
>
>
>
>
>
>
>
>
>

Re: Embedded mode: multiple connection & read-only Db

Posted by Daniel John Debrunner <dj...@apache.org>.
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.

Multiple connections/users/threads are (and always have been) supported, 
will all four ANSI SQL isolation levels and row level locking.

What piece of the documentation gave you the impression that Derby only 
supported a single connection? We need to change it.

Thanks,
Dan.

Re: Embedded mode: multiple connection & read-only Db

Posted by Stanley Bradbury <St...@gmail.com>.
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