H2 database error: Database may be already in use: “Locked by another process”

后端 未结 13 1122
时光取名叫无心
时光取名叫无心 2020-12-12 23:52

I am trying to use the H2 database from a Java application.

I created the database and its tables through the H2 Console and then I try to connect from Java using <

13条回答
  •  轮回少年
    2020-12-13 00:42

    I'm using h2db with a test T24 tafj application, I had the same problem but I managed to resolve it by identifying the application that is running h2 (launched when I attempted to setup a database connection).

    ps aux|grep java
    

    will give output as:

    sysadmin 22755  3.2  0.1 5189724 64008 pts/3   Sl   08:28   0:00 /usr/java/default/bin/java -server -Xmx2048M -XX:MaxPermSize=256M -cp h2-1.3.175.jar:/r14tafj/TAFJ/dbscripts/h2/TAFJFunctions.jar org.h2.tools.Server -tcp -tcpAllowOthers -baseDir /r14tafj/t24/data
    

    now kill this with its process id:

    kill -9 22755
    

    and at last remove the lock file:

    rm -f dbname.lock.db
    

提交回复
热议问题