简体   繁体   中英

Can't get existing table from embedded hsqldb

To use embedded database I have created hsqldb database connected with java by this tutorial .

In general it is about creating simple table with 3 records through hsqldb manager and connect to this database with java.

Database was created and after exit the manager and connect again I gained my tables. They are recorded in test.script file.

If I try to connect with java by

connection = DriverManager.getConnection("jdbc:hsqldb:file:/db/test;ifexists=true", "SA", "");

then I got connection and can read all tables from it by

resultSet = statement.executeQuery("SELECT TABLE_NAME, COLUMN_NAME, TYPE_NAME, COLUMN_SIZE, DECIMAL_DIGITS, IS_NULLABLE FROM INFORMATION_SCHEMA.SYSTEM_COLUMNS WHERE TABLE_NAME NOT LIKE 'SYSTEM_%'");

But I can't get previous created table in manager even if script file contains that table.

This snippet of create table is placed in test.script file:

CREATE MEMORY TABLE PUBLIC.SALARYDETAILS(EMPID VARCHAR(6) PRIMARY KEY,SALARY INTEGER NOT NULL,BONUS INTEGER NOT NULL,INCREMENT INTEGER NOT NULL)

I was confused by MEMORY command, but maybe it is not what I should to fix. After remove it manager add it there again.

----- update 1 -----

SHUTDOWN command didn't help. I don't know how HSQLDB store data, but thought that when they are in script file, it is done.

Exception what is see in the command line when running Java is user lacks privilege or object not found

----- update 2 -----

I have created a table in Java and record data into it and I was available to get these data, but can't see it in the manager. It seems to me like different database, but location is same.

Script file doesn't contain new table and data. I don't know where data are stored.

It seems the database file was not saved. Before you exit the manager, execute this SQL command:

SHUTDOWN

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM