How can i view all tables

  • someba

    someba - 2005-01-12

    Hi all,

    i am trying to read all table names from hsqldb. But when i tried to run "show table" query in java code, i got following error;

    java.sql.SQLException: Unexpected token: SHOW in statement [show]
        at org.hsqldb.jdbc.jdbcUtil.sqlException(Unknown Source)
        at org.hsqldb.jdbc.jdbcStatement.fetchResult(Unknown Source)
        at org.hsqldb.jdbc.jdbcStatement.executeQuery(Unknown Source)
        at Test.query(
        at Test.main(

    some part of code is:
            conn = DriverManager.getConnection(
                    "jdbc:hsqldb:" + "192.168.x.x", "sa","");
    st = conn.createStatement(); // statement objects can be reused with
    rs = st.executeQuery("show tables");

    Do you have any idea to get table names from hsql db?

    • Anonymous - 2005-01-12

      as a non-portable SQL query:

      select * from system_tables;


      As a portable jdbc routine (sorry if I get some parameters wrong the specs):

      conn  = DriverManager.getConnection(...)
      dbmd = conn.getMetaData();
      rs      = dbmd.getTables(null, null, null);

      while ( {

      Also, take Blaine's interactive commandline org.hsqldb.util.SQLTool for a drive...I believe it provides commands to list the tables and to describe individual tables.

    • Jakob Jenkov

      Jakob Jenkov - 2005-01-12

      ... this isn't the help forum... but anyways.

      ... use the DatabaseMetaData available from a connection. I use it to list all tables in a database. It works nicely, and it's portable across JDBC compliant databases.

    • niche

      niche - 2005-03-22

      select * from system_tables


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks