0 Replies Latest reply on Oct 29, 2007 2:42 PM by Anuradha Vijayanand

    beginner- sqlexception with hsqldb

    Anuradha Vijayanand Newbie

      I am trying to use hsqldb in jboss-4.0.5.GA .I tried the following small jdbc code .

      import java.sql.Connection;
      import java.sql.DriverManager;
      import java.sql.ResultSet;
      import java.sql.ResultSetMetaData;
      import java.sql.SQLException;
      import java.sql.Statement;

      class JDBC_test
      public static void main(String args[])
      Connection conn=null;
      Statement select=null;
      System.out.println("Driver loaded...");
      catch(Exception e)
      System.out.println("Failed to load hsql driver.");

      conn = DriverManager.getConnection("jdbc:hsqldb:file:db/anu","sa","");
      System.out.println("connected to hsql..");
      select = conn.createStatement();
      System.out.println("after create statement..");
      catch(Exception e) {System.out.println("create statement failed");}

      ResultSet result = select.executeQuery("SELECT custid,firstname FROM customer_details");
      System.out.println("Got results:");
      while (result.next())
      { // process results one row at a time
      int key = result.getInt(1);
      String val = result.getString(2);

      System.out.println("key = " + key);
      System.out.println("val = " + val);
      } catch (Exception e) {

      try { conn.close(); }
      catch(Exception e){e.printStackTrace();}


      I have a table customer_details created with few columns in the stand alone mode.

      But I am getting the following error while running the code

      Driver loaded...
      connected to hsql..
      after create statement..
      java.sql.SQLException: Table not found in statement [SELECT custid,firstname FRO
      M customer_details]
      at org.hsqldb.jdbc.Util.sqlException(Unknown Source)
      at org.hsqldb.jdbc.jdbcStatement.fetchResult(Unknown Source)
      at org.hsqldb.jdbc.jdbcStatement.executeQuery(Unknown Source)
      at JDBC_test.main(JDBC_test.java:36)

      Can anyone help me out with this error?

      thanks and regards,