unable to connect to to the same database from two different processes (using server mode)

72 views
Skip to first unread message

spacewiz

unread,
Sep 21, 2012, 2:47:24 PM9/21/12
to h2-da...@googlegroups.com
Hello,

I'm not sure what's wrong, I'm not able to connect to the same database from two processes at the same time.

Both processes (running on the same machine but different JVMs) are connecting via TCP server :

jdbc:h2:tcp://localhost/~/my_database;IGNORECASE=TRUE

I checked a number of forum postings and documentation, and I think I'm doing everything as I'm supposed to...

First process connects fine, but the second process is getting this error while trying to connect:


========================

org.h2.jdbc.JdbcSQLException: Database may be already in use: "Locked by another process". Possible solutions: close all other connection(s); use the server mode [90020-169]

at org.h2.message.DbException.getJdbcSQLException(DbException.java:329)

at org.h2.message.DbException.get(DbException.java:169)

at org.h2.message.DbException.get(DbException.java:146)

at org.h2.store.FileLock.getExceptionAlreadyInUse(FileLock.java:441)

at org.h2.store.FileLock.lockFile(FileLock.java:337)

at org.h2.store.FileLock.lock(FileLock.java:129)

at org.h2.engine.Database.open(Database.java:542)

at org.h2.engine.Database.openDatabase(Database.java:222)

at org.h2.engine.Database.<init>(Database.java:217)

at org.h2.engine.Engine.openSession(Engine.java:56)

at org.h2.engine.Engine.openSession(Engine.java:159)

at org.h2.engine.Engine.createSessionAndValidate(Engine.java:138)

at org.h2.engine.Engine.createSession(Engine.java:121)

at org.h2.engine.Engine.createSession(Engine.java:28)

at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:305)

at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:109)

at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:93)

at org.h2.Driver.connect(Driver.java:72)

at java.sql.DriverManager.getConnection(DriverManager.java:582)

at java.sql.DriverManager.getConnection(DriverManager.java:185)


=======================


Any help will be much appreciated !

Ryan How

unread,
Sep 23, 2012, 8:09:56 AM9/23/12
to h2-da...@googlegroups.com
Not sure what is going on, but it definitely works, must be something
not right in what you are doing.

How are you starting the tcp server?
> --
> You received this message because you are subscribed to the Google
> Groups "H2 Database" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/h2-database/-/_-gcBlwjF6oJ.
> To post to this group, send email to h2-da...@googlegroups.com.
> To unsubscribe from this group, send email to
> h2-database...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/h2-database?hl=en.


Reply all
Reply to author
Forward
0 new messages