PreparedStatement ps = null;
PreparedStatement ps  = null; PreparedStatement ps2 = null;
     public void revokeAllCertByCA(Admin admin, String issuerdn, int reason){		Connection con = null;    	PreparedStatement ps = 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, CertificateData.CERT_REVOKED); // first statusfield			ps.setString(2, bcdn); // issuerdn field			ps.setInt(3, CertificateData.CERT_TEMP_REVOKED); // second statusfield		    temprevoked = ps.executeUpdate();            // Second SQL statement, revoking all non revoked certificates.			ps = con.prepareStatement(secondsqlstatement);							ps.setInt(1, CertificateData.CERT_REVOKED); // first statusfield			ps.setLong(2, currentdate); // revokedate field			ps.setInt(3, reason); // revokation reason			ps.setString(4, bcdn); // issuer dn			ps.setInt(5, CertificateData.CERT_REVOKED); // second statusfield						revoked = ps.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 {			 try {				 				 if (ps != null) ps.close();				 if (con!= null) con.close();			 } catch(SQLException se) {				 error("Error cleaning up: ", se);			 }		 }                       		                    } // revokeAllCertByCA