db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chrislumd ...@nlm.nih.gov>
Subject Re: [jira] Updated: (DERBY-393) Allow multiple JVMs to have read-only access to the same directory-based database
Date Wed, 12 Sep 2007 20:54:01 GMT

This feature is exactly what we are looking for in our application.
Just wondering if this patch is completed in the 1.5 or 1.6 version?
Also, can we set this read-only in the derby.properties file?
Such as: 

or simply

since the entire DB need to be read only for allowing multiple connection in
a embedded DB.
Many thanks!

-- Chris

Mike Matrigali wrote:
> I think this patch just takes care of the read only connection side. 
> What happens if another connection comes into the same directory that
> does writes?  Without locking the readonly connection can get serious
> errors because the ondisk version of files can become out of date with
> the in cache version in the other JVM.
> The safest approach seems to create some sort of ADMIN interface which
> would mark the database as read only, and then only read only 
> connections would be allowed.  That seems most straight forward.
> Currently as I understand it the store looks to see if the actual
> files are readonly to put the db in readonly mode, so at that point if
> it could check some sort of marker in the database - maybe in the
> log control file it could do something similar.  Putting this in the
> log is natural as it is the first module to boot when coming up on a
> new database, and owns whether or not writes can be done.
> Another approach that might work depending on the java file locking
> support may be to not avoid the lock file but enhance it.  Allow
> multiple read locks for the readonly db's while excluding
> For context the current readonly support was meant for running derby 
> from some sort of readonly material like a CD.  An example
> application was a catalog application reading the products from a 
> readonly db or another example would be a computer learning product
> where each lesson was data delivered in a static derby database.
> One could allow any connection but fail update operations but that would
> be a lot more work, and does not seem as user friendly.
> Trejkaz (JIRA) wrote:
>>      [ http://issues.apache.org/jira/browse/DERBY-393?page=all ]
>> Trejkaz updated DERBY-393:
>> --------------------------
>>     Attachment: readonly.patch
>> This patch creates a new URL sub-scheme "readonlydirectory" which can be
>> used to load a database from a directory in read-only mode.
>> It isn't ideal... for one, the URL syntax is a little unwieldy.  The
>> syntax is currently like this:
>> jdbc:derby:readonlydirectory:C:\Databases\MyDatabase
>> I would rather the syntax be like this:
>> jdbc:derby:directory:C:\Databases\MyDatabase;readonly=true
>> But I couldn't figure out how to do the latter.  My patch only contains
>> the Java 1.4 version of the read-only store.  For completeness, I suppose
>> you'd need a 1.3 and a 1.4 version.  Either that or a decorator class
>> which wraps any other store.  I suppose that the decorator approach would
>> make re-use a little easier.
>>>Allow multiple JVMs to have read-only access to the same directory-based
>>>         Key: DERBY-393
>>>         URL: http://issues.apache.org/jira/browse/DERBY-393
>>>     Project: Derby
>>>        Type: New Feature
>>>  Components: Store
>>>    Reporter: Trejkaz
>>> Attachments: readonly.patch
>>>For an application I'm building, we needed to permit multiple JVMs to
access the same database.
>>>We couldn't easily use a network server configuration, as it would be
difficult to figure out who to connect to since either user might want to
view the database while the other database is offline.
>>>We couldn't just dump all the data in a JAR file, as our databases often
end up being several gigabytes in size.
>>>So what we really need is a version of the directory store which is
treated as if it were read-only.

View this message in context: http://www.nabble.com/-jira--Created%3A-%28DERBY-393%29-Allow-multiple-JVMs-to-have-read-only-access-to-the-same-directory-based-database-tf103699.html#a12643986
Sent from the Apache Derby Developers mailing list archive at Nabble.com.

View raw message