JDBC Modify Provisioning Rule

Which IIQ version are you inquiring about?

8.4p2

Please share any other relevant files that may be required (for example, logs).

JDBC-Disable-Provision-Rule.txt (4.2 KB)
JDBC-Modify-Provision-Rule.txt (7.1 KB)

Share all details about your problem, including any error messages you may have received.

I have attached our working JDBC-Disable-Provision-Rule when a user terminated this is triggered to remove a user’s access to this system.
This system is on a DB2 mainframe written in COBOL.
I am trying to create a Modify rule that will allow us to remove a single auxiliary role when the access is no longer needed or in the event that a primary role is no longer needed that Primary role must be stopped by entering an end time and a replacement primary role added in its place as a primary role must always be present so I had one created for this situation.

The primary use for this will be during access certifications so in testing I go into my test user and attempt to revoke an auxiliary role and receive the error

BeanShell script error: bsh.ParseException: Parse error at line 59, column 5.

Hi @thomasgoodall,

are you sure the error is one of those rules?

Also, I suggest to you some changes:

  • User PreparedStatement instead of Statement and use setString\setInt\setDate to set the values, for example:
 String insertPrimaryRole = "INSERT INTO DB2ADMIN.APP_AUTH_USER_ROLE " +
                "(AAUSRO_START_TS, AAUSRO_UPDT_UI, AAUSRO_UPDT_TS, AAUSRO_UPDT_PI, AAUSRO_STOP_TS, AAUSRO_AUTH_UI, AAUSRO_ROLE_CD) " +
                "VALUES (?, ?, ?, ?, ?, ?, ?)";

PreparedStatement stmt = conn.prepareStatement(insertPrimaryRole);

Timestamp currentTimeStamp = Timestamp.from(Instant.now());
Timestamp stopTimeStamp = Timestamp.from(Instant.now().plusSeconds(86400)); 

stmt.setTimestamp(1, currentTimeStamp);
stmt.setString(2, "AD1048");
stmt.setTimestamp(3, currentTimeStamp);
stmt.setString(4, "SAILPT");
stmt.setTimestamp(5, stopTimeStamp);
stmt.setString(6, "exampleUser");
stmt.setString(7, "416");

int rowsInserted = stmt.executeUpdate();

PreparedStatement is more readble, secure and set automatically the type of the data.

  • Clean the code and close connection, for example the if on the try-catch are useless and you are closing only the Statment and not the connection and the resultSet(if you will use the PreparedStatement)

Try those changes and retry.

Thank you, Emanuele, I will test out your recommendations today and get back to you asap.