Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Databases / December 2006

Tip: Looking for answers? Try searching our database.

How to detect existing text tables in a hsql db?

Thread view: 
susikaufmann2003@hotmail.com - 19 Dec 2006 12:33 GMT
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();

Susanne
Thomas Kellerer - 19 Dec 2006 12:58 GMT
> 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
[quoted text clipped - 14 lines]
> }
> 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
susikaufmann2003@hotmail.com - 19 Dec 2006 13:53 GMT
> You need to issue a SHUTDOWN statement before closing the connection to
> your database. Otherwise HSQLDB does not write everything to disk.

Thank you for the fast answer. Now it works without problems :).

Susanne


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.