简体   繁体   English

java.sql.SQLException:数据库被锁定错误

[英]java.sql.SQLException: database is locked error

I'm in a situation where I get Database is locked on the statement: 我处于以下状态: 数据库被锁定在语句上:

pst = conn.prepareStatement(cIQuery);

Where pst is PreparedStatement object and conn is the Connection object and cIQuery is the query which is going to be executed. 其中pstPreparedStatement对象, connConnection对象, cIQuery是将要执行的查询。 However, I have closed all the Connection , ResultSet and PreparedStatement objects in each class after use. 但是,使用后,我已经关闭了每个类中的所有ConnectionResultSetPreparedStatement对象。 How can I overcome this problem? 我该如何克服这个问题?

You may need to check the processes working on that database. 您可能需要检查在该数据库上工作的进程。 You may be running your project multiple times and launching different processes as a result. 您可能会多次运行您的项目,结果启动了不同的流程。 So it may happen that some process is still alive and holding the database lock. 因此,可能会发生某些进程仍处于活动状态并保持数据库锁定的情况。 Try checking the processes status using command 尝试使用命令检查进程状态

ps -eaf

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM