Hi Luigi,
<context-param>
<param-name>db.url</param-name>
<param-value>jdbc:h2:~/.myapp/data</param-value>
</context-param>
...
Now, I'm trying to connect using an external client, using the url
jdbc:h2:tcp://localhost/~/.myapp/data but I am getting the error
"Database may be already in use: "Locked by another process". Possible
solutions: close all other connection(s); use the server mode
[90020-166] 90020/90020"
I understood that h2 can work in "Automatic Mixed Mode" which I
managed to make it work.
If I specify the url jdbc:h2:tcp://localhost/~/.myapp/data instead of
jdbc:h2:~/.myapp/data in the web.xml, then it works. But the
documentation makes an example which consistent with mine (using a
local url in the web.xml), so I thought it should work. But it
doesn't: I need to connect always using tcp even from the web app?
Is it possible to have the web application access the database in
embedded mode while the external applications accessing it through
server mode, without using the *Automatic* Mixed Mode?
What am I doing wrong?
I think you misunderstood automatic mixed mode. The critical part is the
extra AUTO_SERVER parameter on the end of the URL eg
jdbc:h2:~/.myapp/data;AUTO_SERVER=TRUE
Both the web app and the external client use exactly the same URL (the
automatic part). The first connection (should be the web app) connects
in embedded mode while the second connection automatically connects via
tcp. It is explained here:
http://www.h2database.com/html/features.html#auto_mixed_mode
Regards,
Peter
--
You received this message because you are subscribed to the Google Groups "H2
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/h2-database?hl=en.