db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew McIntyre" <mcintyr...@gmail.com>
Subject Re: Trouble accessing read only DB with 10.1 (created and accessed fine with 10.0)
Date Thu, 06 Jul 2006 06:12:16 GMT
On 7/5/06, Leslie Software <lesliesoftware@yahoo.com> wrote:
> I was using and just this evening upgraded to but I cannot open my
read-only database any more.
> My connection code does this
>         //  Initialize the derby driver
>         Class.forName ("org.apache.derby.jdbc.EmbeddedDriver"); //$NON-NLS-1$
>         .... // code that setups up connectionString eliminated
>         myConnection = DriverManager.getConnection (connectionString);
> Where connectionString is:
> jdbc:derby:jar:(P:\WizardsFamiliar2\com.lesliesoftware.wizardsfamiliar.database\Cards.jar)MtGCards
> And there is a Cards.jar with a MtGCards database inside at the specified location.
> The call to getConnection throws the following execption:
> XJ040.C
> SQL Exception: Failed to start database 'jar:(P:\WizardsFamiliar2\com.lesliesoftware.wizardsfamiliar.database\Cards.jar)MtGCards',
see the next exception for details.
> The next exception is:
> 40XD1
> SQL Exception: Container was opened in read-only mode.
> I reviewed the 10.1 documentation and it looks just the same as in 10.0 <http://db.apache.org/derby/docs/10.1/devguide/cdevdeploy11201.html>.
 What am I doing wrong?  What changes do I need to make?

Hmm. It appears there is a definite problem with 'soft upgrade' in
10.1. Derby's soft upgrade capability *should* allow you to use a 10.0
database with a 10.1 Derby engine without any modifications to your
database. However, it appears that there is a problem here.

I am able to reproduce the error you describe. And the error goes away
if I upgrade the database to a 10.1 database, jar it up, and then try
to connect to it with a 10.1 engine. An upgrade to the database format
cannot be accomplished while the database is in a jar, i.e. while it
is in a read-only format.

As for a workaround, you can upgrade your 10.0 database by connecting
to it with a 10.1 engine with the upgrade=true attribute (e.g. through

$ java org.apache.derby.tools.ij
ij version 10.1
ij> connect 'jdbc:derby:/WizardsFamiliar2/com.lesliesoftware.wizardsfamiliar.database/MtGCards;upgrade=true';

Connecting to the 10.0 database with the upgrade=true attribute will
upgrade the database to the 10.1 database format. You can then jar the
upgraded Derby 10.1 database into a jar and connect to it using any
version of Derby 10.1.

However, I think this should not be necessary. Derby's soft upgrade
procedures should allow connections to a database created with a
previous version of Derby without explicitly upgrading your database.
So, there definitely seems to be a problem with soft upgrade with
respect to databases in a jar.

I will file a bug for this problem. Hopefully we can find a resolution shortly.


View raw message