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: >Hi There, > >I have a Derby database that is giving me a read-only error (25502), and I >don't know why. The database was working fine, up until about a month ago. >Now, I cannot INSERT, UPDATE, or DELETE from the database - I always get >ERROR 25502. I checked Windows Security permissions (user has Full Control: >READ/MODIFY/WRITE/etc.), File attributes (all files in the database >directory are writable); finally, I deleted the 'db.lck' file that is in the >database directory. > >There are multiple users accessing this database (different Windows >accounts) - each account gets the same error. It may be that the database >was shutdown improperly the last time it was running, I don't know. > > ---- SNIP --- >Thomas > >P.S. I receive this error when I run IJ and when I use a connection through >Java. > > > Driver: org.apache.derby.jdbc.EmbeddedDriver > Version: 10.1.1.0 >JDBC URL: jdbc:derby:../db/MyDB > O/S: Windows XP TPC Edition, SP2 > >ERROR 25502: An SQL data change is not permitted for a read-only connection, >user or database. > at >org.apache.derby.iapi.error.StandardException.newException(Unknown Source) > at >org.apache.derby.impl.sql.conn.GenericAuthorizer.authorize(Unknown Source) > at >org.apache.derby.impl.sql.execute.GenericResultSetFactory.getDeleteResultSe t >(Unknown Source) > at >org.apache.derby.exe.ac80220011x010axae9bx8591x0000000e94181.fillResultSet( U >nknown Source) > at >org.apache.derby.exe.ac80220011x010axae9bx8591x0000000e94181.execute(Unknow n >Source) > at org.apache.derby.impl.sql.GenericActivationHolder.execute(Unknown >Source) > at >org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown Source) > at >org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown Source) > at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source) > at org.apache.derby.impl.jdbc.EmbedStatement.executeUpdate(Unknown >Source) > ... --- SNIP --- Hi Thomas - As Øystein stated this problem happens when there is a problem during the startup / booting of the database. In other cases where the problem did not just 'go away' the cause has been traced to file related issues like permissions, invalid database files (non-Derby files or directories with a Derby system filename), file descriptor limitations, use of non-hard-disk storage (flash drives, etc), other processes (e.g. backups) locking the files and issues like these. In addition to using a recent build to see if the additional logging provides a clue you can rebuild the database from scratch in a fresh environment without any resource restrictions set and using the local hard disk. Do this from an administrator account and see if the problem occurs in this copy. If it does not happen then re-examine the existing system to see how it differs and try eliminating the differences. It might help to reset the existing system including rebooting the machine then remove the db.lck and derby.log files (if they exist) and try accessing the database using IJ from an administrator account. Hope this helps - as you can see this symptom can occur from any number of reasons and I sure we have not identified them all yet.
