Java Method to Expire Oracle passwords
If you are looking to expire Oracle passwords, here is one Java method we used in one of our iStore implementations, where the user required us to have this feature when a user registers online.
Dependencies for this code has not been discussed here. Request for support by emailing support@ibizsoftinc.com.
void updateFNDUserPasswordExpirationDays(BigDecimal userID) throws FrameworkException {
Object txn = new Object();
TransactionScope.begin(txn);
OracleConnection conn = null;
try {
conn = (OracleConnection) TransactionScope.getConnection();
}
catch (Exception _ex) {
throw new FrameworkException(“Error getting connection.”);
}
if (conn == null)
throw new FrameworkException(“Null connection received”);
PreparedStatement ps = null;
try {
ps = conn.prepareStatement(“update fnd_user set password_lifespan_days = :1 where user_id = :2″);
ps.setBigDecimal(1, new BigDecimal(90));//set to 90 days
ps.setBigDecimal(2, userID);
int i = ps.executeUpdate();
}
catch (Exception e) {
TransactionScope.setRollbackOnly();
throw new FrameworkException(e, “updateFNDUserPasswordExpirationDays”);
}
finally {
try {
if (ps != null)
ps.close();
}
catch (Exception _ex) {
}
TransactionScope.end(txn);
}
}
There are no comments yet.