Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how can change derby to READ/WRITE mode

Tags:

java

derby

I have a Derby database that is giving me a read-only error. The database was working fine, up until last week when disk ran out of space:

Caused by: java.io.IOException: No space left on device
        at java.io.RandomAccessFile.writeBytes0(Native Method)
        at java.io.RandomAccessFile.writeBytes(RandomAccessFile.java:520)
        at java.io.RandomAccessFile.write(RandomAccessFile.java:550)
        at org.apache.derby.impl.store.raw.log.LogAccessFile.writeToLog(Unknown Source)
        at org.apache.derby.impl.store.raw.log.LogAccessFile.flushDirtyBuffers(Unknown Source)
        ... 23 more

I cleaned up disk and there are 80% of disk is freed for derby. But the derby is still in read-only mode:

java.sql.SQLException: An SQL data change is not permitted for a read-only connection, user or database.
org.apache.derby.impl.jdbc.EmbedSQLException: An SQL data change is not permitted for a read-only connection, user or database.
org.apache.derby.iapi.error.StandardException: An SQL data change is not permitted for a read-only connection, user or database.

I found there is a db.lck file (which file size is 0) there, can I remove that file? Is there any other way to change it read/write mode? Thank you!

like image 778
Gary Avatar asked Sep 09 '14 14:09

Gary


People also ask

How to use Derby database in Java?

To connect to the network server via Java code you need to have the derbyclient. jar in your classpath. The network connection string to this database is the IP address of the server:portnumber. For example for a server which is running on localhost you can create a new database via the following string.

How to install apache Derby in windows?

Download the Derby database software from the Apache website at http://db.apache.org/derby/derby_downloads.html. Extract the files into the directory that you have created for the Derby database. For example: C:\Derby. Set the DERBY_HOME system variable to the location of your Derby installation.

How do I run a SQL file in Derby?

Right-click the restaurants. sql file in the Package Explorer view and select Apache Derby, Run SQL Script using 'ij'. The Console view shows the SQL commands contained in the file and executing in ij along with the output of the commands.


1 Answers

The reason I got the SQL error was due to a lock file owned by root. I found it in the .artifactory/derby directory, it was called db.lck, and removing it got artifactory to start up just fine again.

We run artifactory under Tomcat, and the .artifactory directory was in the home directory of the user that started Tomcat.

like image 163
Marvo Avatar answered Oct 16 '22 12:10

Marvo