【发布时间】:2016-03-24 18:48:09
【问题描述】:
我有一个名为“test.db”的 H2 数据库文件。该文件位于我的应用程序中 目录:“myApp/resources/test.db”。 我无法让这对我有用。那么,引用相对路径的正确方法是什么。
这里是我的hibernate.cfg.xml的配置。
<property name="connection.driver_class">org.h2.Driver</property>
<property name="connection.url">jdbc:h2:file:/test</property>
<property name="connection.username">test</property>
<property name="connection.password">1234</property>
<!-- SQL dialect -->
<property name="dialect">org.hibernate.dialect.H2Dialect</property>
发生的错误是:
Caused by: 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:file:/test2". Use an absolute path, ~/name, ./name, or the baseDir setting instead. [90011-191]
【问题讨论】: