java 如何将 derby 更改为 READ/WRITE 模式
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25747227/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
how can change derby to READ/WRITE mode
提问by Gary
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:
我有一个 Derby 数据库,它给了我一个只读错误。数据库运行良好,直到上周磁盘空间不足:
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:
我清理了磁盘,有 80% 的磁盘被释放用于德比。但是 derby 仍然处于只读模式:
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!
我发现那里有一个 db.lck 文件(文件大小为 0),我可以删除那个文件吗?有没有其他方法可以改变它的读/写模式?谢谢!
采纳答案by Gary
I cleaned up disk but I didn't reboot my java process which connected to derby. I killed the process and restarted it, derby is in read/write mode.
我清理了磁盘,但没有重新启动连接到 derby 的 java 进程。我杀死了该进程并重新启动它,derby 处于读/写模式。
回答by Marvo
The reason I got the SQL error was due to a lock file owned by root. I found it in the .artifactory/derbydirectory, it was called db.lck, and removing it got artifactory to start up just fine again.
我得到 SQL 错误的原因是 root 拥有的锁定文件。我在.artifactory/derby目录中找到了它,它被称为db.lck,然后将其删除得到了 artifactory 再次启动就好了。
We run artifactory under Tomcat, and the .artifactory directory was in the home directory of the user that started Tomcat.
我们在Tomcat下运行artifactory,.artifactory目录在启动Tomcat的用户家目录下。

