Re: How to detect existing text tables in a hsql db?




On 19.12.2006 13:33 susikaufmann2003@xxxxxxxxxxx wrote:
I have a Java-Application that creates several text-tables at the first
start. When I start the application again I just want to check, if the
text tables exist. But the application always returns a "false, table
does not exist" and the localdb.properties and localdb.script files are
written new. After that, the tables can be detected, but only until the
next start of the application.

dbcon.connect(LOCALDRIVER, LOCALPROTOCOL, LOCALDATABASE, LOCALUSER,
LOCALPASS);

DatabaseMetaData metadata = dbcon.con.getMetaData();
String[] aTyps = new String[]{"TABLE"};

ResultSet result = metadata.getTables(null, null, "%", aTyps);
while (result.next()) {
System.out.println(result.getString("TABLE_NAME"));
}
result.close();

You need to issue a SHUTDOWN statement before closing the connection to your database. Otherwise HSQLDB does not write everything to disk.

See: http://www.hsqldb.org/doc/guide/ch01.html#N101DB

Thomas
.