atorg.sqlite.DB.throwex(DB.java:288)atorg.sqlite.DB.ensureAutoCommit(DB.java:336)atorg.sqlite.DB.execute(DB.java:264)atorg.sqlite.Stmt.exec(Stmt.java:56)atorg.sqlite.Stmt...
at org.sqlite.DB.throwex(DB.java:288)
at org.sqlite.DB.ensureAutoCommit(DB.java:336)
at org.sqlite.DB.execute(DB.java:264)
at org.sqlite.Stmt.exec(Stmt.java:56)
at org.sqlite.Stmt.executeQuery(Stmt.java:90)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
可是我上面把stmt和rs都close()掉了。
执行删除方法:public int execute(String sql) throws Exception {
int result = -1;
try {
stmt = conn.createStatement();
result = stmt.executeUpdate(sql);// 执行SQL语句把值赋予result
System.out.println(result);
} catch (SQLException e) {
throw e;
}
return result;
}
关闭方法:public int closestmt(){
int i=0;
try {
rs.close();
rs=null;
stmt.close();
stmt=null;
i=1;
} catch (SQLException e) {
e.printStackTrace();
i=0;
}
return i;
}
展开