H2 - Multiple applications access same H2 database

≡放荡痞女 提交于 2019-12-24 04:51:06

问题


I am using embedded database H2 in 2 web applications say WebApp1 and WebApp2. I run WebApp1 and execute some query to access H2 database. Mean while I run WebApp2, but it throws exception that H2 is currently been used by another process

My need is, I should be able to use H2 database by WebApp1 and WebApp2 at the same time. I analysed the below link but it tells about multiple connections but not about multiple applications.

http://www.h2database.com/html/features.html#multiple_connections

回答1:


You can use the embedded mode for WebApp1 and the server mode for WebApp2: in order to get this trick, both urls must be like "jdbc:h2:mydb;AUTO_SERVER=TRUE"

More info here: http://h2database.com/html/features.html#auto_mixed_mode



来源:https://stackoverflow.com/questions/25520922/h2-multiple-applications-access-same-h2-database

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!