H2错误[90011-187]

时间:2015-04-28 14:00:08

标签: database h2

我正在尝试在linux中创建一个数据库:

  1. 它不在用户家中
  2. 不要求客户端通知db文件的整个服务器路径。
  3. 需要与bin目录不同,以防止核心转储失败。
  4. 文档说你可以使用这样的网址:

    jdbc:h2:file:data/sample 
    

    但是这个简单的网址不起作用并收到以下错误:

    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:file:db/datadb;TRACE_LEVEL_FILE=3". Use an absolute path,
    ~/name, ./name, or the baseDir setting instead. [90011-187]
    

    观察:我知道你可以使用“。”,但在这种情况下客户的网址是什么?

1 个答案:

答案 0 :(得分:3)

文档错误。我会更新它。

jdbc:h2:file:data/sample

应该是:

jdbc:h2:file:./data/sample

许多用户遇到问题,因为他们使用jdbc:h2:test之类的东西,然后找不到数据库文件,或者在另一个目录中运行应用程序时创建了第二个数据库。这就是1.4.x版本中的原因,现在相对路径仅在使用.时起作用,如jdb:h2:./test中那样。

顺便说一句,您已经问过这个问题in the H2 Google Group as well

相关问题