Attribute Sync in JDBC

Hi,

I have 5 attributes configured for JDBC attribute sync. With just one attribute configured for Sync, the rule to invoke update stored proc works fine. Can anyone share some reference rule where multiple attribute changes happens in one request

Hi @chandramohan27 ,

can you try below code

List accounts = plan.getAccountRequests();
  for ( AccountRequest account : accounts ) {
	for (AttributeRequest attrReq : Util.iterate(account.getAttributeRequests())) {
		if ( account != null ) {
			String attributeName = (String) attributeRequest.getName();
			attrReq = account.getAttributeRequest(attributeName);
			if ( attrReq != null && ProvisioningPlan.Operation.Set.equals(attrReq.getOperation())) {
				CallableStatement stModify = connection.prepareCall("? = call dbo.up_modifyUserAccess(?, ?, ?)");
				stModify.registerOutParameter(1, java.sql.Types.INTEGER);
				stModify.setString(2, employeeID);
				stModify.setString(3, attributeName); // Attribute name
				stModify.setString(4, newRoleValue); // New value of the attribute
				stModify.execute();
			}
		}
	}
}

Modify the code accordingly, Hope this helps

Thank you

2 Likes

@rkhade

In my usecase, I have to pass all 5 attributes as input arguments to the stored proc. Even if there is no change in value for 4 attributes, I need to pass all 5 to update that one attribute.

So, I’m thinking to get the values using JDBC select query and set the same value if the attribute is not present in attribute request.

But wanted to check if there is any better solution than what i think.

@chandramohan27 , I think that is the way we can pass the attribute values which are not present in the plan.

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.