Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why am I receiving an error when trying to create the database by the URL of "jdbc:h2:test"

I am trying to create a database with the URL of "jdbc:h2:test:, as stated on H2's web site (here) under "Where are the Database Files Stored?". It states "If the base directory is not set (as in jdbc:h2:test), the database files are stored in the directory where the application is started (the current working directory).", which is exactly what I would like.

I am receiving the error "A file path that is implicitly relative to the current working directory is not allowed in the database URL "jdbc:h2:test". Use an absolute path, ~/name, ./name, or the baseDir setting instead. [90011-182] 90011/90011".

What does this error mean? And why can't I create a database with the URL that H2's web site tells me to use?

Thank you in advance for any helpful answers.

Regards,

Ryan Shukis

like image 353
Ryan Avatar asked Feb 12 '23 15:02

Ryan


2 Answers

The answer is in the H2 Error documentation. It's a good practice - especially when dealing with RDBMS, which tend to have cryptic errors, to look up the error number in their manuals.

In essence, this is not allowed by default, to prevent confusion. You can set a system option to disable checking this, or you could use an explicitly relative path (./test).

like image 197
RealSkeptic Avatar answered Feb 14 '23 11:02

RealSkeptic


I would suggest trying the jdbc:h2:file:C:/data/test URL instead and making the path an explicit path to your application folder. (As shown at the end of the same paragraph that your current URL came from).

Its complaining about relative paths not being viable, so give it an absolute path instead.

like image 23
Keith Enlow Avatar answered Feb 14 '23 13:02

Keith Enlow