Same JVM 3 different database connections - is giving me errors

129 views
Skip to first unread message

Sanjeev Sharma

unread,
Aug 17, 2012, 3:12:26 PM8/17/12
to h2-da...@googlegroups.com
We have 3 h2 databases embedded and we connect using the file url.  The first one connects and when we attempt the 2nd one - we get the following exception.  The one that says NewPortal...is the one that is connected already.  The one that says ssharma in the file path is what I am attempting to connect and I get this error:
Any help is appreciated.
org.h2.jdbc.JdbcSQLException: IO Exception: "C:/Users/ssharma/AppData/Local/Temp/v360-6216063115481358173 outside C:/NewPortal/Portal/database/h2" [90028-162]
        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.engine.ConnectionInfo.setBaseDir(ConnectionInfo.java:178)
        at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:105)
        at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:94)
        at org.h2.Driver.connect(Driver.java:72)
        at java.sql.DriverManager.getConnection(DriverManager.java:582)
        at java.sql.DriverManager.getConnection(DriverManager.java:185)

Sanjeev Sharma

unread,
Aug 17, 2012, 4:11:55 PM8/17/12
to h2-da...@googlegroups.com
This seems to be an issue if I use the h2.baseDir property.  When opening the first database connection we are setting the system property h2.baseDir to C:/NewPortal... and any other connection going forward is giving me this exception.  Should we not use this property?  What is the workaround?

Thomas Mueller

unread,
Aug 17, 2012, 4:51:50 PM8/17/12
to h2-da...@googlegroups.com
Hi,

It looks like you have use the option "-baseDir" "C:/NewPortal/Portal/database/h" when starting the server, and then tried to use an absolute database URL of the form "jdbc:h2:tcp://localhost/C:/Users/ssharma/AppData/Local/Temp/v360-6216063115481358173". This is not allowed. When using the option -baseDir, only databases within that directory may be accessed. See also http://h2database.com/html/advanced.html#remote_access

Regards,
Thomas


--
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/-/ihR1LNZ3CscJ.
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