Hello.
I discovered h2 today, and I'm very excited about it.
I am trying to embed h2 into a web app, so following the documentation
(pdf, page 25) I did this in my web.xml
<web-app>
...
<context-param>
<param-name>db.url</param-name>
<param-value>jdbc:h2:~/.myapp/data</param-value>
</context-param>
<context-param>
<param-name>db.user</param-name>
<param-value>sa</param-value>
</context-param>
<context-param>
<param-name>db.password</param-name>
<param-value>sa</param-value>
</context-param>
<context-param>
<param-name>db.tcpServer</param-name>
<param-value>-tcpAllowOthers -trace</param-value>
</context-param>
<listener>
<listener-class>org.h2.server.web.DbStarter</listener-class>
</listener>
...
</web-app>
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?
Thanks
Luigi
--
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.