db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stanley Bradbury <Stan.Bradb...@gmail.com>
Subject Re: ERROR 25502: An SQL data change is not permitted for a read-only connection
Date Tue, 25 Apr 2006 18:45:42 GMT
Thomas J. Taylor wrote:

>Hello everyone,
>
>I'm having a bit of trouble with a Derby 10.1.1.0 database. My ultimate
>question is how do I recover from ERROR XSDB4 - I have been searching
>through the manuals and have yet to find information about crash recovery. 
>
>Any help is appreciated.
>
>Thomas
>
>
>And now, the details...
>
>Previously, I reported getting ERROR 25502 (cannot change read-only data)
>through a JDBC connection. This computer has three Derby 10.1.1.0 databases
>(MyDB-1, MyDB-2, MyDB-3). I would receive ERROR 25502 when accessing MyDB-1
>or MyDB-2 through JDBC. The ERROR 25502 would crash the system before
>getting to MyDB-3.
>
>After further testing on the computer with IJ, I am able to READ, CREATE,
>INSERT, UPDATE, and DROP data from MyDB-1 and MyDB-2, but when I try to
>access MyDB-3 through IJ, I now get ERROR XJ040 "Failed to start database
>C:\db\MyDB-3" (see IJ TEST below).
>
>----- START IJ TEST -----
>C:\Program Files\Java\jre1.5.0_04\bin\java -classpath
>derby-10.1.1.0.jar;derbytools-10.1.1.0.jar -Dij.protocol=jdbc:derby:
>-Dij.database=C:\DB\MyDB-3 -Dij.driver=org.apache.derby.jdbc.EmbeddedDriver
>org.apache.derby.tools.ij Read_Test.sql
>
>SELECT * FROM MyTable;
>
>ERROR XJ040: Failed to start database 'C:\DB\MyDB-3', see the next exception
>for details.
>ERROR XSDB4: Page Page(2,Container(0, 3392)) is at version 906, the log file
>contains change version 1,325, either there are log records of this page
>missing, or this page did not get written out to disk properly.
>----- END IJ TEST -----
>
>Between the JDBC ERROR 25502 problem and the IJ ERROR XJ040 problem, I had
>the computer administrator delete DB.LCK from MyDB-1, MyDB-2, and MyDB-3;
>and confirm that Windows WRITE access was allowed on all databases.
>
>
>
>Thomas J. Taylor wrote:
>
>  
>
 = = SNIP  = = =

This error means that the database is corrupted.  The only recourse is 
to recover the data from backup. 

This kind of corruption is most often caused by double booting the 
database.  The file db.lck is an internal management file used to 
prevent double booting and should never to modified / deleted manually 
lest corruption occur.  I suspect either two instances of your program 
or IJ and your program accessed MyDB-3 at the same time.  The second 
embedded connection, not finding a db.lck file, will create it's own 
data cache and cause the transaction logfile to be processed and 
cleared.  The first connection will continue working from it's data 
cache thinking that it's work in progress is safely logged but, in fact, 
it was rolled back by connection 2.  Both will write logpages with their 
own version sequence until the log records need to be read - I suspect 
Derby will crash at this point and the next boot attempt will produce 
the error you are experiencing. 

Can the database be rebuilt?


Mime
View raw message