访问HSQLDB数据库时出现NullPointerException

时间:2014-08-26 18:46:50

标签: java sql jdbc hsqldb

我在java程序中通过一个jdbc驱动器访问HSQLDB。数据库的脚本文件如下。

CREATE SCHEMA PUBLIC AUTHORIZATION DBA

CREATE CACHED TABLE TBL1(ID CHAR(5),NAME VARCHAR(11),ZIP VARCHAR(11))

CREATE UNIQUE INDEX IDX_ID ON TBL1(ID)

CREATE CACHED TABLE TBL2(ID CHAR(5),STREET CHAR(5))

CREATE INDEX IDX_RS_ID ON TBL2(ID)

CREATE CACHED TABLE TBL3(ID VARCHAR(8) NOT NULL PRIMARY KEY,LON FLOAT,LAT FLOAT)

CREATE GLOBAL TEMPORARY MEMORY TABLE OVERLAY(ID CHAR(8),AROUTE CHAR(10),ZROUTE 

CHAR(10),TYPE CHAR(8)) ON COMMIT PRESERVE ROWS

SET TABLE TBL1 INDEX'4490648 5643624 0'

SET TABLE TBL2 INDEX'529105280 529105280 0'

SET TABLE TBL3 INDEX'775814624 0'

CREATE VIEW OVERLAYSPAN (ID,STREET) AS SELECT DISTINCT ID, NAME FROM OVERLAY AS O, TBL2 as 
R WHERE O.ID = R.ID

CREATE USER SA PASSWORD ""

GRANT DBA TO SA

SET WRITE_DELAY 10

在java程序中,我首先从TBL1中删除所有条目(1000个条目)并在同一个表中重新插入新条目(1500)。程序正常执行,但是,当我尝试重新执行相同的程序时,我收到以下错误。

java.sql.SQLException: error in script file line: 9 S1000 General error 

java.lang.NullPointerException in statement [SET TABLE TBL2 INDEX'529105280 529105280 0']

这是程序中的填充堆栈跟踪。

java.sql.SQLException: error in script file line: 9 S1000 General error java.lang.NullPointerException in statement [SET TABLE TBL2 INDEX'529105280 529105280 0']
at org.hsqldb.jdbc.Util.sqlException(Unknown Source)
at org.hsqldb.jdbc.jdbcConnection.<init>(Unknown Source)
at org.hsqldb.jdbcDriver.getConnection(Unknown Source)
at org.hsqldb.jdbcDriver.connect(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at HSQLTesting.main(HSQLTesting.java:98)

在第98行,程序正在尝试与数据库建立连接。

Connection sqlconnect = DriverManager.getConnection("jdbc:hsqldb:file:C:/birdseyedb/birdseye", "SA", "");

知道这里出了什么问题吗?

提前致谢。

0 个答案:

没有答案