无法在HSQLDB中删除表
我无法在HSQLDB中使用默认用户SA(或任何用户)删除表,即使我可以创建表并阅读它们,但请参阅下面的代码,出现了什么问题? 另一方面,如果我使用第三方SQL客户端(例如松鼠),即使用户为空时,我也可以登录并丢弃表格而不会出现问题。
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/64447.html
