マネージド Bean で更新クエリを作成しようとしています。コードは次のとおりです。
try {
PreparedStatement checkDB1 = (PreparedStatement) con.prepareStatement("update pocket set balance=? where username=?");
checkDB1.setDouble(1, (double) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("selectedUserBalance")-total); //This returns the desired result
checkDB1.setString(2, (String) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("selectedAccountIban")); //Returns the desired result
checkDB1.executeQuery();
} catch (SQLException e) {
System.err.println("SQLState: " + ((SQLException)e).getSQLState());
System.out.println("SQLState: " +((SQLException)e).getSQLState());
}
パラメータが正しく設定されていることがわかりますが、クエリにエラーがあるようです。catch ブロックに入ります。また、スタック トレースを表示する方法がわかりません。e.printStackTrace が機能しません。どうすれば表示できますか? 誰でも助けることができますか?
ありがとう