Problem with JDBC Url (h2 server mode)

4,643 views
Skip to first unread message

Stefan Beigel

unread,
May 3, 2014, 3:34:13 PM5/3/14
to h2-da...@googlegroups.com
Hi guys

Getting this exception while starting h2:
"A file path that is implicitly relative to the current working directory is not allowed in the database URL"
My jdbc string is jdbc:h2:tcp://localhost//data

This happens only with version 
Version 1.4.178 (2014-05-02), Beta

yours sincerely
______
Stefan

Noel Grandin

unread,
May 4, 2014, 4:17:28 AM5/4/14
to h2-da...@googlegroups.com
We stopped supporting current directory relative url's because people kept not being able to find their database files. 

Use something like
jdbc:h2:tcp://localhost//~/data. 
--
You received this message because you are subscribed to the Google Groups "H2 Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to h2-database...@googlegroups.com.
To post to this group, send email to h2-da...@googlegroups.com.
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

Thomas Mueller

unread,
May 4, 2014, 7:54:27 AM5/4/14
to h2-da...@googlegroups.com
Hi, 

Hm, I think your url should work, as it's absolute due to double slash (database in the root directory). I will investigate. 

Regards, Thomas 
--

Thomas Mueller

unread,
May 5, 2014, 1:46:15 AM5/5/14
to h2-da...@googlegroups.com
Hi,

I can't reproduce the problem with your database URL. Do you use Windows? Do you use the "baseDir" setting? Could you post the complete error message including all stack traces please?

Regards,
Thomas

Stefan Beigel

unread,
May 6, 2014, 2:33:17 PM5/6/14
to h2-da...@googlegroups.com
Hi

I am using windows 8.1
I don't use basedir

stacktrace from webinterface
A file path that is implicitly relative to the current working directory is not allowed in the database URL "jdbc:h2:tcp://localhost//data". Use an absolute path, ~/name, ./name, or the baseDir setting instead. [90011-178] 90011/90011 (Hilfe)
org.h2.jdbc.JdbcSQLException: A file path that is implicitly relative to the current working directory is not allowed in the database URL "jdbc:h2:tcp://localhost//data". Use an absolute path, ~/name, ./name, or the baseDir setting instead. [90011-178]
    at org.h2.message.DbException.getJdbcSQLException(DbException.java:344)
    at org.h2.message.DbException.get(DbException.java:178)
    at org.h2.message.DbException.get(DbException.java:154)
    at org.h2.engine.ConnectionInfo.getName(ConnectionInfo.java:392)
    at org.h2.engine.Engine.openSession(Engine.java:42)
    at org.h2.engine.Engine.openSession(Engine.java:164)
    at org.h2.engine.Engine.createSessionAndValidate(Engine.java:142)
    at org.h2.engine.Engine.createSession(Engine.java:125)
    at org.h2.server.TcpServerThread.run(TcpServerThread.java:150)
    at java.lang.Thread.run(Unknown Source)

    at org.h2.engine.SessionRemote.done(SessionRemote.java:610)
    at org.h2.engine.SessionRemote.initTransfer(SessionRemote.java:129)
    at org.h2.engine.SessionRemote.connectServer(SessionRemote.java:434)
    at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:315)
    at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:107)
    at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:91)
    at org.h2.Driver.connect(Driver.java:74)
    at org.h2.server.web.WebServer.getConnection(WebServer.java:684)
    at org.h2.server.web.WebApp.login(WebApp.java:958)
    at org.h2.server.web.WebApp.process(WebApp.java:212)
    at org.h2.server.web.WebApp.processRequest(WebApp.java:171)
    at org.h2.server.web.WebThread.process(WebThread.java:138)
    at org.h2.server.web.WebThread.run(WebThread.java:94)
    at java.lang.Thread.run(Unknown Source) 


Iam using older version now.
Maybe switching to jdbc:h2:tcp://localhost//~/data. 



Am Montag, 5. Mai 2014 07:46:15 UTC+2 schrieb Thomas Mueller:
Hi,

I can't reproduce the problem with your database URL. Do you use Windows? Do you use the "baseDir" setting? Could you post the complete error message including all stack traces please?

Regards,
Thomas


On Sunday, May 4, 2014, Thomas Mueller <thomas.to...@gmail.com> wrote:
Hi, 

Hm, I think your url should work, as it's absolute due to double slash (database in the root directory). I will investigate. 

Regards, Thomas 

On Saturday, May 3, 2014, Stefan Beigel <beigel...@gmail.com> wrote:
Hi guys

Getting this exception while starting h2:
"A file path that is implicitly relative to the current working directory is not allowed in the database URL"
My jdbc string is jdbc:h2:tcp://localhost//data

This happens only with version 
Version 1.4.178 (2014-05-02), Beta

yours sincerely
______
Stefan

--
You received this message because you are subscribed to the Google Groups "H2 Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to h2-database+unsubscribe@googlegroups.com.

Thomas Mueller

unread,
May 7, 2014, 1:46:55 AM5/7/14
to h2-da...@googlegroups.com
Hi,

I found the problem, it will be fixed in the next release. It seems to be happening only in Windows by the way.

Regards,
Thomas
To unsubscribe from this group and stop receiving emails from it, send an email to h2-database...@googlegroups.com.

Matthew Lohbihler

unread,
Jun 10, 2014, 12:13:36 PM6/10/14
to h2-da...@googlegroups.com
I'm getting this error message even with a non-relative url. What's wrong with this?

A file path that is implicitly relative to the current working directory is not allowed in the database URL "jdbc:h2:/Users/Matthew/git/ma-core-public/Core/target/test/h2/ma;DB_CLOSE_ON_EXIT=FALSE". Use an absolute path, ~/name, ./name, or the baseDir setting instead. [90011-178]

Thanks,
Matthew

Thomas Mueller

unread,
Jun 13, 2014, 9:19:48 AM6/13/14
to H2 Google Group
Hi,

I don't know, I can't reproduce the problem with your URL. Did you set the "h2.baseDir" directory? Do those directories exist, and what is in the directory? Does a directory "ma" exist within "h2"? Do you get the same exception if you use a standalone program, such as:

    public static void main(String[] args) throws Exception {
        String url = "jdbc:h2:/Users/mueller/temp/ma-core-public/Core/target/test/h2/ma";
        DriverManager.getConnection(url);
    }

Regards,
Thomas


Matthew Lohbihler

unread,
Jun 24, 2014, 11:57:15 AM6/24/14
to h2-da...@googlegroups.com
Yes, i still get the same exception.

    public static void main(String[] args) throws SQLException {
        DriverManager
                .getConnection("jdbc:h2:/Users/Matthew/git/ma-core-public/Core/target/test/h2/ma;DB_CLOSE_ON_EXIT=FALSE");
    }


Exception in thread "main" org.h2.jdbc.JdbcSQLException: A file path that is implicitly relative to the current working directory is not allowed in the database URL "jdbc:h2:/Users/Matthew/git/ma-core-public/Core/target/test/h2/ma;DB_CLOSE_ON_EXIT=FALSE". Use an absolute path, ~/name, ./name, or the baseDir setting instead. [90011-178]

    at org.h2.message.DbException.getJdbcSQLException(DbException.java:344)
    at org.h2.message.DbException.get(DbException.java:178)
    at org.h2.message.DbException.get(DbException.java:154)
    at org.h2.engine.ConnectionInfo.getName(ConnectionInfo.java:392)
    at org.h2.engine.Engine.openSession(Engine.java:42)
    at org.h2.engine.Engine.openSession(Engine.java:164)
    at org.h2.engine.Engine.createSessionAndValidate(Engine.java:142)
    at org.h2.engine.Engine.createSession(Engine.java:125)
    at org.h2.engine.Engine.createSession(Engine.java:27)
    at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:335)

    at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:107)
    at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:91)
    at org.h2.Driver.connect(Driver.java:74)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at Test.main(Test.java:7)


This is using version 1.4.178.

Regards,
Matthew

Thomas Mueller

unread,
Jun 24, 2014, 12:32:04 PM6/24/14
to H2 Google Group
Hi,

Could you try again with the very latest version? There was a change in this area (even thought, this was for Windows), maybe it works now. If not, do you use any system properties (for example the h2.baseDir)? Could you post the complete stack trace(es)?

Regards,
Thomas

Matthew Lohbihler

unread,
Jun 24, 2014, 5:31:46 PM6/24/14
to h2-da...@googlegroups.com
Same code using versoin 1.4.179 appears to result in the same stack trace.

Exception in thread "main" org.h2.jdbc.JdbcSQLException: A file path that is implicitly relative to the current working directory is not allowed in the database URL "jdbc:h2:/Users/Matthew/git/ma-core-public/Core/target/test/h2/ma;DB_CLOSE_ON_EXIT=FALSE". Use an absolute path, ~/name, ./name, or the baseDir setting instead. [90011-179]
    at org.h2.message.DbException.getJdbcSQLException(DbException.java:345)
    at org.h2.message.DbException.get(DbException.java:179)
    at org.h2.message.DbException.get(DbException.java:155)
    at org.h2.engine.ConnectionInfo.getName(ConnectionInfo.java:398)
    at org.h2.engine.Engine.openSession(Engine.java:43)
    at org.h2.engine.Engine.openSession(Engine.java:165)
    at org.h2.engine.Engine.createSessionAndValidate(Engine.java:143)
    at org.h2.engine.Engine.createSession(Engine.java:126)
    at org.h2.engine.Engine.createSession(Engine.java:26)

    at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:335)
    at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:107)
    at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:91)
    at org.h2.Driver.connect(Driver.java:72)

    at java.sql.DriverManager.getConnection(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at Test.main(Test.java:7)


Noel Grandin

unread,
Jun 25, 2014, 2:58:11 AM6/25/14
to h2-da...@googlegroups.com


On 2014-06-24 11:31 PM, Matthew Lohbihler wrote:
> Same code using versoin 1.4.179 appears to result in the same stack trace.
>
> Exception in thread "main" org.h2.jdbc.JdbcSQLException: A file path that is implicitly relative to the current working
> directory is not allowed in the database URL
> "jdbc:h2:/Users/Matthew/git/ma-core-public/Core/target/test/h2/ma;DB_CLOSE_ON_EXIT=FALSE". Use an absolute path, ~/name,
> ./name, or the baseDir setting instead. [90011-179]

Is this a windows box or a Linux box?
Because if it's a windows box, then that is not an absolute location.
You'd need to use something like:

jdbc:h2:C:/Users/Matthew/git/ma-core-public/Core/target/test/h2/ma;DB_CLOSE_ON_EXIT=FALSE

Matthew Lohbihler

unread,
Jun 27, 2014, 1:38:30 PM6/27/14
to h2-da...@googlegroups.com
Windows. And yes, that solves the problem. Thanks Noel.

Thomas Mueller

unread,
Jul 3, 2014, 8:13:18 AM7/3/14
to h2-da...@googlegroups.com
Hi,

OK, I didn't think that would be the problem. I will add this to the documentation "For Windows, an absolute path also needs to include the drive ("C:/...").".

Regards,
Thomas
Reply all
Reply to author
Forward
0 new messages