JDBC Application Provision Rule

Which IIQ version are you inquiring about?

Version 8.3

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

Provision Rule - TechCent.xml (12 KB)

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

Hello,
I have been trying to implement JDBC provision rule to create new user. All the attributes in my table are NOT NULL. And the code I have been trying to use is mentioned below. I am not able to fix the errors but still not successful. Can any please help me to find out where I have been making mistake in my code?
Thank you!

What is the error you are getting

Is the roles a column in your DB table and comma separated and are you trying to update that as well during creation, if that’s case your prepared statement query is incorrect as you are setting total 6 values but in your query it doesn’t seem to have anything related to roles ( column 4 in your code)
Please recheck

				PreparedStatement statement = connection.prepareStatement("insert into `techcent`.`identites` (UserId,DisplayName,FirstName,LastName,EmailID) values (?,?,?,?,?)");

And also post what is the exact error you are getting

I think problem might be that your SQL query in line 102 accepts 5 attributes while you assign 6 attributes with line 106

2 Likes

I see you don’t have roles column included in your prepared statement on line 102 but you are trying to set that in lines 112 to 120. You will have to fix your prepared statement in line 102.

1 Like

I have rectified the prepared statement. The error that I am encountering is mentioned below:

Error BeanShell script error: bsh.ParseException: Parse error at line 80, column 39. Encountered: ; BSF info: Provision Rule - TechCent at line: 0 column: columnNo

Thank you for the response. I have rectified the prepared statement now.

Please share the updated code to understand where exactly it is failing after the change

Provision Rule - TechCent.xml (13.8 KB)

Hello Satish,
Please find attached the updated code file.
I have 2 tables in my db, one for user details and other named as “roles” for storing the roles that we need to assign to users. I want to provision role to user in SailPoint which then gets updated in DB. I have about a year of experience with SailPoint IAM and am still in the learning phase so that’s why getting stuck. If you can please help.

Correct this at line 125

if ( ( accounts != null ) && ( accounts.size() > 0 ) ) {

It has to be

if ( ( accounts != null ) && ( accounts.size() > 0 ) ) {

I have done the mentioned changes in line125. Now I am getting this below mentioned error:

Error java.sql.SQLIntegrityConstraintViolationException: Column ‘DisplayName’ cannot be null

All the attributes in my tables are NOT NULL

@ArpitaSB
Its very evident the value is coming as null

				statement.setString(2, getAttributeRequestValue(account, "DisplayName"));

Please check your plan first if all the attribute requests are coming properly and if not check your provisioning policies or source of your plan code to check what is the issue.

If possible share your plan from logs, looks like you are already printing this.

@ArpitaSB
Based on the Error java.sql.SQLIntegrityConstraintViolationException: Column ‘DisplayName’ cannot be null

It is clear that you are passing the null value in “DisplayName”
As mentioned by @iamksatish do check the plan.

To troubleshoot this issue and to narrow down can you try passing passing a default value for the DisplayName and see

String defaultDisplayName = "DefaultDisplayName"; // you can set any string here and check
statement.setString(2, getAttributeRequestValue(account, "DisplayName") != null ? getAttributeRequestValue(account, "DisplayName") : defaultDisplayName);

Hello @iamksatish @rajeshs

I have written one different complete code by myself for this application provisioning. The previous one I took it from someone so I was getting confused. Please find the new code attached below:

Provision Rule - TechCent1.xml (6.0 KB)

For this code, the error I am getting is mentioned below:

Error BeanShell script error: bsh.EvalError: Sourced file: inline evaluation of: import java.util.Date; import java.sql.Connection; import java.sql.DriverManag . . . '' Token Parsing Error: Lexical error at line 76, column 97. Encountered: "\r" (13), after : "\" account.getAttributeRequests()) {" : at Line: 57 : in file: inline evaluation of: import java.util.Date; import java.sql.Connection; import java.sql.DriverManag . . . ‘’ : ProvisioningResult result = new ProvisioningResult ( ) BSF info: Provision Rule - Tech Cent at line: 0 column: columnNo

You are having syntax errors
for(AttributeRequest attrReq " account.getAttributeRequests()) {

should be replaced with
for(AttributeRequest attrReq : account.getAttributeRequests()) {

Hello @iamksatish @kjakubiak @SanjeevEdgile @rajeshs

Thank you soo much for all your help in this issue. I was able to sort out all the errors and now my provisioning rule is working. Your collective efforts have truly helped me alot and it means alot. :blush: