IO异常:" / root / test / opt / h2 / DB

时间:2016-09-10 07:22:00

标签: java spring hibernate h2

目前我安装了H2数据库,但是当我启动程序并尝试从浏览器(http://localhost:8082/login.do)访问它时,我收到此错误:

IO Exception: "/root/test outside /opt/h2/DB" [90028-192] 90028/90028 (Aide) org.h2.jdbc.JdbcSQLException: IO Exception: "/root/test outside /opt/h2/DB" [90028-192]
    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.setBaseDir(ConnectionInfo.java:182)
    at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:114)
    at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:102)
    at org.h2.Driver.connect(Driver.java:72)
    at org.h2.server.web.WebServer.getConnection(WebServer.java:735)
    at org.h2.server.web.WebApp.login(WebApp.java:955)
    at org.h2.server.web.WebApp.process(WebApp.java:211)
    at org.h2.server.web.WebApp.processRequest(WebApp.java:170)
    at org.h2.server.web.WebThread.process(WebThread.java:133)
    at org.h2.server.web.WebThread.run(WebThread.java:89)
    at java.lang.Thread.run(Thread.java:745)

我如何解决这个问题?

2 个答案:

答案 0 :(得分:2)

只需添加一个“”即可。数据库名称之前。例如,这是我的数据库jdbc:h2:tcp://localhost:9101/~/test的jdbc URL,我将其更改为jdbc:h2:tcp://localhost:9101/~./test可以使用。我在一个论坛上读到此错误与H2有关。

答案 1 :(得分:0)

你应该改变形式 jdbc url 和 h2-data 是你启动 h2 服务器数据路径

jdbc:h2:/h2-data/test