A quick glance at the code confirms that Derby only raises this error when Derby thinks that the connection is in read-only mode. I don't see any bugs logged about instability in this area. The following operations can put the connection in read-only mode:
1) Setting the derby.database.readOnlyAccessUsers and derby.database.defaultConnectionMode properties. 2) Booting the database from a read-only medium like a jar file. 3) Calling Connection.setReadOnly(). >From the stack trace, I see that your application runs on Hibernate. I don't know enough about Hibernate to speculate about whether Hibernate ever changes the connection to read-only. Hope this helps, -Rick On 10/28/13 8:49 PM, 冯之浩 wrote: > Hi,all > In my application,I use Derby to store datas. There is an error > sometimes happens during the application running. > "ERROR - An SQL data change is not permitted for a read-only > connection, user or database." > It seems that the derby user has no enough privilege to write > datas.But I am sure the account running the application is > Administrator,and the application runs well most of time ,so I think > the privilege is not the reason of the error. > And the other cause I guess is that there is no enough disk space,so > the derby can't write datas from memory to disk.But I can't check the > computer runs the application now. > So I need your help to tell me if any other reasons can lead into this > error? > Thank you! > The detail of error/exception is here and in the attachment > [2013-10-24 08:07:47] WARN - SQL Error: 20000, SQLState: 25502 > [2013-10-24 08:07:47] ERROR - An SQL data change is not permitted for > a read-only connection, user or database. > Caused by: java.sql.SQLException: An SQL data change is not permitted > for a read-only connection, user or database. > at > org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown > Source) > at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source) > at > org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown > Source) > at > org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown > Source) > at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown > Source) > at org.apache.derby.impl.jdbc.ConnectionChild.handleException(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) > at > org.hibernate.jdbc.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:23) > at > org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2247) > ... 54 more > Caused by: java.sql.SQLException: An SQL data change is not permitted > for a read-only connection, user or database. > at > org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown > Source) > at > org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown > Source) > ... 65 more > Caused by: 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.ac30c4ec5ex0141xe7b7xd10bx000000ca98b00.fillResultSet(Unknown > Source) > at > org.apache.derby.exe.ac30c4ec5ex0141xe7b7xd10bx000000ca98b00.execute(Unknown > Source) > at org.apache.derby.impl.sql.GenericActivationHolder.execute(Unknown > Source) > at > org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(Unknown > Source) > at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown > Source) > ... 59 more > ------------------------------------------------------------------------ > Best Regards > ------------------------------------------------------------ > Hobson > IT Department > (0755)86205899-3583 > [email protected] <mailto:[email protected]> > TP-LINK Technologies Co.,Ltd. > Date2013-10-2911:13:45
