Announcing the Saviynt Knowledge Exchange unifying the Saviynt forums, documentation, training,
and more in a single search tool across platforms. Read the announcement here.
No ratings
Saviynt Employee
Saviynt Employee




Database connections require JSON's to handle special characters incase this hasn't been taken care of on target. If special character are not handled properly, any updates made will fail. This can be achieved by using the escapeSQL method of the StringEscapeUtils() constructor. 



Additional Solution details:


1. public class StringEscapeUtils extends Object - Escapes and unescapes Strings for Java, Java Script, HTML, XML, and SQL.

2. escapeSql method details: 

  • public static String escapeSql(String str) - Escapes the characters in a String to be suitable to pass to an SQL query
  •  Example: 
statement.executeQuery("SELECT * FROM MOVIES WHERE TITLE='" +   StringEscapeUtils.escapeSql("McHale's Navy") +    "'");
  • At present, this method only turns single-quotes into doubled single-quotes ("McHale's Navy" => "McHale''s Navy").
  • It does not handle the cases of percent (%) or underscore (_) for use in LIKE clauses.
  • Parameters: str - the string to escape, may be null
  • Returns: a new String, escaped for SQL, null if null string input



JSON Syntax in Saviynt: 


Grant Access JSON:

{"ROLE"  : ["insert into  SYSADM.PS_AVB_SAVIYNT_ACT(EMPLID , OPRID, FIRST_NAME , MIDDLE_NAME, LAST_NAME, EMAILID, ROLENAME, DATETIME_ADDED, ACTION_MSG, STATUS1 , DATETIME_UPDATED) values ('${user.username}','${task.accountName}' ,'${org.apache.commons.lang.StringEscapeUtils.escapeSql(user.firstname)}', '${user.middlename}', '${org.apache.commons.lang.tringEscapeUtils.escapeSql(user.lastname)}', '${}','${task.entitlement_valueKey.entitlement_value}', sysdate, 'ADD', 'OPEN', sysdate)"]}



Further Reading:



Version history
Last update:
‎09/06/2023 07:56 PM
Updated by: