You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by "Thomas J. Taylor" <Th...@Craggle.com> on 2006/04/20 22:36:20 UTC

ERROR 25502: An SQL data change is not permitted for a read-only connection, user or database.

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.

The Derby database doesn't use encryption or security. It was created using
the 'create=true' property in the DB URL.

Does anyone have an idea of why I may be experiencing this error, and more
importantly, how I can recover from this error? I checked the docs about
ERROR 25502, but couldn't find anything useful.

Thanks for your help.

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.getDeleteResultSet
(Unknown Source)
	at
org.apache.derby.exe.ac80220011x010axae9bx8591x0000000e94181.fillResultSet(U
nknown Source)
	at
org.apache.derby.exe.ac80220011x010axae9bx8591x0000000e94181.execute(Unknown
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)
	...

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.getInsertResultSet
(Unknown Source)
	at
org.apache.derby.exe.ac80220011x010axae9bx8591x0000000e94183.fillResultSet(U
nknown Source)
	at
org.apache.derby.exe.ac80220011x010axae9bx8591x0000000e94183.execute(Unknown
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.EmbedPreparedStatement.executeStatement(Unknown
Source)
	at
org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(Unknown
Source)
	...



Re: ERROR 25502: An SQL data change is not permitted for a read-only connection, user or database.

Posted by Stanley Bradbury <St...@gmail.com>.
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.getDeleteResultSet
>(Unknown Source)
>	at
>org.apache.derby.exe.ac80220011x010axae9bx8591x0000000e94181.fillResultSet(U
>nknown Source)
>	at
>org.apache.derby.exe.ac80220011x010axae9bx8591x0000000e94181.execute(Unknown
>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)
>	...
>
>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)
>  
>
--- 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.


Re: ERROR 25502: An SQL data change is not permitted for a read-only connection, user or database.

Posted by Øystein Grøvlen <Oy...@Sun.COM>.
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.

Derby may set a database to be read-only if something goes wrong during 
the booting of the database (e.g., not able to create db.lck file).  Is 
there any message written to derby.log during the booting of the system? 
  It might be that you will get more information in derby.log if you run 
with on a recent build instead of a released version.  (I guess it would 
be a good idea to try this on a copy of your database).  I added more 
output to derby.log for this case in DERBY-555.

--
Øystein