1

I am unable to drop table with default user SA(or any user for that matter) in HSQLDB even though I can create table and read them without problem, please see my code below, what's wrong? On the other hand, If I use a third party SQL client(eg. squirrel), I can login and drop table without problem even when user is empty.

 public static void main(String[]args){ try { DBManager.executeUpdate("drop table mytable"); } catch (SQLException ex) { ex.printStackTrace(); } } public static Connection getConnection(){ Connection c =null; try { c = DriverManager.getConnection("jdbc:hsqldb:file:e:\\xxx_db\\xxx", "SA", ""); } catch (SQLException ex) { ex.printStackTrace(); } return c; } public static int executeUpdate(String s) throws SQLException { Connection con = getConnection(); try{ return con.createStatement().executeUpdate(s); } finally{ if(con!=null)try { con.close(); } catch (SQLException ex) { Logger.getLogger(DBManager.class.getName()).log(Level.SEVERE, null, ex); } } } 
3
  • Are you getting an error/Exception? Is the SQL succeeding but the table is still there? Commented Jun 2, 2011 at 20:20
  • @Adam Batkin: I am not getting any exceptions, the SQL seems to be succeeding but table is still there.. Commented Jun 2, 2011 at 20:37
  • Do you have rows in the DUAL table? Commented Jun 2, 2011 at 21:14

2 Answers 2

1

It turns out I need to do an explicit shutdown aftwards

 DBManager.executeUpdate("shutdown"); 
Sign up to request clarification or add additional context in comments.

Comments

0

Try committing after executing the DDL.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.