I am having some trouble calling my java method. So, I have button in my front end in jsf. Where, I am calling my java method to disable 2 factor, I have sql procedure as well. Can any one check my java method and my sql statement, if all is well. Thanks
Here is my code: (java method)
public void disableTwoFactor() throws SQLException {
CallableStatement ps = null;
Connection conn = null;
ResultSet result = null;
getConfirmationCode();
if (confirmationCodeFromUser.equals(Integer.toString(confirmationCodeFromServer))) {
try {
//get database connection
conn = DataUtility.getDataSource().getConnection();
ps = conn.prepareCall(strDisableTwoFactor);
ps.clearParameters();
ps.setInt(1, this.id);
ps.setString(2, this.number);
ps.setString(3, this.passwordConfirmationStatus);
ps.registerOutParameter(4, OracleTypes.CURSOR);
ps.executeQuery();
getPassStatus(conn);
result = (ResultSet) ps.getObject(4);
result.next();
if (result.getString(1).equals("YES")) {
if (displayPassSignupPage == true) {
FacesContext.getCurrentInstance().addMessage("codeVerify",
new FacesMessage("You are now two-factor free"));
} else {
FacesContext.getCurrentInstance().addMessage("codeVerify",
new FacesMessage("You are now two-factor free"));
}
}
} catch (Exception ex) {
ex.printStackTrace();
} finally {
if (ps != null) {
ps.close();
}
if (conn != null) {
conn.close();
}
ps = null;
conn = null;
}
}
}
SQL Statement
private static final String strDisableTwoFactor = "{call BEAN.DD_DISABLE_TWO_FACTOR(?,?,?,?,?,?)}";