unable to drop table in HSQLDB
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_dbxxx", "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);
}
}
}
尝试执行DDL后提交。
事实证明,我需要做一个明确的关机
DBManager.executeUpdate("shutdown");
链接地址: http://www.djcxy.com/p/64448.html
上一篇: Play框架/ Netty不释放套接字
下一篇: 无法在HSQLDB中删除表
