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

后端 未结 13 1126
时光取名叫无心
时光取名叫无心 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:20

    You can also delete file of the h2 file database and problem will disappear.

    jdbc:h2:~/dbname means that file h2 database with name db name will be created in the user home directory(~/ means user home directory, I hope you work on Linux).

    In my local machine its present in: /home/jack/dbname.mv.db I don't know why file has a name dbname.mv.db instead a dbname. May be its a h2 default settings. I remove this file:

    rm ~/dbname.mv.db 
    

    OR:

    cd ~/ 
    rm dbname.mv.db 
    

    Database dbname will be removed with all data. After new data base init all will be ok.

提交回复
热议问题