con = getConnection();
con = JDBCUtil.getDBConnection(JNDINames.DATASOURCE);
    public void revokeAllCertByCA(Admin admin, String issuerdn, int reason) {        Connection con = null;        PreparedStatement ps = null;        PreparedStatement ps2 = null;        int temprevoked = 0;        int revoked = 0;        String bcdn = CertTools.stringToBCDNString(issuerdn);        final String firstsqlstatement = "UPDATE CertificateData SET status=?" +                " WHERE issuerDN=? AND status = ? ";        final String secondsqlstatement = "UPDATE CertificateData SET status=?, revocationDate=?, revocationReason=?" +                " WHERE issuerDN=? AND status <> ?";        long currentdate = new Date().getTime();        try {            // First SQL statement, changing all temporaty revoked certificates to permanently revoked certificates            con = getConnection();            ps = con.prepareStatement(firstsqlstatement);            ps.setInt(1, CertificateDataBean.CERT_REVOKED); // first statusfield            ps.setString(2, bcdn); // issuerdn field            ps.setInt(3, CertificateDataBean.CERT_TEMP_REVOKED); // second statusfield            temprevoked = ps.executeUpdate();            // Second SQL statement, revoking all non revoked certificates.            ps2 = con.prepareStatement(secondsqlstatement);            ps2.setInt(1, CertificateDataBean.CERT_REVOKED); // first statusfield            ps2.setLong(2, currentdate); // revokedate field            ps2.setInt(3, reason); // revokation reason            ps2.setString(4, bcdn); // issuer dn            ps2.setInt(5, CertificateDataBean.CERT_REVOKED); // second statusfield            revoked = ps2.executeUpdate();            getLogSession().log(admin, bcdn.hashCode(), LogEntry.MODULE_CA, new java.util.Date(), null, null, LogEntry.EVENT_INFO_REVOKEDCERT, ("Revoked All CAs certificates successfully. Permantly revoked :" + (revoked + temprevoked) + " Certificates with reason: " + reason));        } catch (Exception e) {            getLogSession().log(admin, bcdn.hashCode(), LogEntry.MODULE_CA, new java.util.Date(), null, null, LogEntry.EVENT_ERROR_REVOKEDCERT, "Error when trying to revoke a CA's all certificates", e);            throw new EJBException(e);        } finally {            JDBCUtil.close(con, ps, null);            JDBCUtil.close(ps2);        }    } // revokeAllCertByCA