HSQLDB - 用户缺少未找到的权限或对象:SQLState(42501)供应商代码(-5501)

时间:2014-03-18 12:14:41

标签: jdbc hsqldb

我已经从hsqldb_1.8.10迁移到hsqldb_2.3.2版本,但突然hsqldb停止工作。我尝试了很多来解决问题,但找不到问题的根本原因。我用Google搜索并获得了很多链接,但没有什么能解决我的问题。

我已复制日志和脚本文件以供参考。

DriverManager日志

DriverManager.getConnection("jdbc:hsqldb:hsql://ip_address/database")
trying driver[className=sun.jdbc.odbc.JdbcOdbcDriver,sun.jdbc.odbc.JdbcOdbcDriver@1c695a6]
*Driver.connect (jdbc:hsqldb:hsql://ip_address/database)
trying driver[className=org.hsqldb.jdbc.JDBCDriver,org.hsqldb.jdbc.JDBCDriver@1386918]
getConnection returning       
driver[className=org.hsqldb.jdbc.JDBCDriver,org.hsqldb.jdbc.JDBCDriver@1386918]
SQLState(42501) vendor code(-5501)
java.sql.SQLSyntaxErrorException: user lacks privilege or object not found: RESULTS

Database.script 文件

SET DATABASE UNIQUE NAME HSQLDB44D4CB4776 SET DATABASE GC 0 SET DATABASE DEFAULT RESULT MEMORY ROWS 0 SET DATABASE EVENT LOG LEVEL 0 SET DATABASE TRANSACTION CONTROL LOCKS SET DATABASE DEFAULT ISOLATION LEVEL READ COMMITTED SET DATABASE TRANSACTION ROLLBACK ON CONFLICT TRUE SET DATABASE TEXT TABLE DEFAULTS '' SET DATABASE SQL NAMES FALSE SET DATABASE SQL REFERENCES FALSE SET DATABASE SQL SIZE TRUE SET DATABASE SQL TYPES FALSE SET DATABASE SQL TDC DELETE TRUE SET DATABASE SQL TDC UPDATE TRUE SET DATABASE SQL TRANSLATE TTI TYPES TRUE SET DATABASE SQL CONCAT NULLS TRUE SET DATABASE SQL UNIQUE NULLS TRUE SET DATABASE SQL CONVERT TRUNCATE TRUE SET DATABASE SQL AVG SCALE 0 SET DATABASE SQL DOUBLE NAN TRUE SET FILES WRITE DELAY 500 MILLIS SET FILES BACKUP INCREMENT TRUE SET FILES CACHE SIZE 10000 SET FILES CACHE ROWS 50000 SET FILES SCALE 32 SET FILES LOB SCALE 32 SET FILES DEFRAG 0 SET FILES NIO TRUE SET FILES NIO SIZE 256 SET FILES LOG TRUE SET FILES LOG SIZE 50 CREATE USER SA PASSWORD DIGEST 'd41d8cd98f00b204e9800998ecf8427e' ALTER USER SA SET LOCAL TRUE CREATE SCHEMA PUBLIC AUTHORIZATION DBA ALTER SEQUENCE SYSTEM_LOBS.LOB_ID RESTART WITH 1 SET DATABASE DEFAULT INITIAL SCHEMA PUBLIC GRANT USAGE ON DOMAIN INFORMATION_SCHEMA.SQL_IDENTIFIER TO PUBLIC GRANT USAGE ON DOMAIN INFORMATION_SCHEMA.YES_OR_NO TO PUBLIC GRANT USAGE ON DOMAIN INFORMATION_SCHEMA.TIME_STAMP TO PUBLIC GRANT USAGE ON DOMAIN INFORMATION_SCHEMA.CARDINAL_NUMBER TO PUBLIC GRANT USAGE ON DOMAIN INFORMATION_SCHEMA.CHARACTER_DATA TO PUBLIC GRANT DBA TO SA SET SCHEMA SYSTEM_LOBS INSERT INTO BLOCKS VALUES(0,2147483647,0)

1 个答案:

答案 0 :(得分:1)

我也遇到了同样的错误。最后我自己解决了。问题是因为连接网址不正确。

connection = DriverManager.getConnection
             ("jdbc:hsqldb:file:///D:/hsql/testdb;shutdown=true;ifexists=true", "sa", "");

此处testdb是您尝试连接的数据库的名称。我使用eclipse数据源插件连接到hsql。配置相同时,我已将数据库位置指定为D:/ hsql / testdb。这样就引起了这个问题。

在testdb中创建表之前,我试图从testdb中检索一个表。

此外,如果使用eclipse数据源插件连接到db,请确保在运行java应用程序之前已执行SHUTDOWN命令,否则将引发以下错误

Database lock acquisition failure: lockFile:
org.hsqldb.persist.LockFile@d9999e76[file =D:\hsql\testdb.lck, exists=true, locked=false, valid=false, ] 
method: checkHeartbeat read: 2015-09-30 15:09:55 heartbeat - read: -3700 ms

希望这有用。