问题
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