我正在尝试创建一种从Oracle数据库中删除用户帐户的方法,但是只要执行代码ps.executeUpdate() > 0
,该程序就不会返回任何内容或终止。我尝试直接查询到数据库,它工作。有什么想法吗?
public boolean deleteAccount(int account_ID) {
try {
System.out.println("This is read");
Connection conn = Jdbcconnection.getConnection();
String sql = "DELETE FROM ACCOUNTS where account_ID = ?";
System.out.println("This is read");
PreparedStatement ps = conn.prepareStatement(sql);
ps.setInt(1, account_ID);
System.out.println("This is read");
return ps.executeUpdate() > 0;
} catch(SQLException e) {
e.printStackTrace();
}
return false;
}