Skip to main content

This content has been archived and is no longer being updated. Links may not function; however, this content may be relevant to outdated versions of the product.

Support Article

String with backslash causes database exception

SA-20168

Summary




Whenever a SQL insert statement contains a backslash character, in the values to be inserted; but PRRuntime exception is thrown and the database insert fails.


Error Messages



Caused by: com.pega.pegarules.data.internal.access.rdb.TokenMgrError: Lexical error at line 1, column 303. Encountered: " " (32), after : "\\"
 

Steps to Reproduce



1. Create an activity
2. Add a java step.
3  Put the below example code in the java step:


     String aSQL = "INSERT INTO {Class:XYZ-FW-RQSFW-Work-ABCDapp} (PZINSKEY, TESTPROPERTY) values ('123', 'test\\ dbtest test')";
                                 ClipboardPage aList = tools.createPage("Code-Pega-List", "");
                                 aList.putString("pyObjClass", "Work-");
                                 aList.putString("pyMaxRecords", "0");
                                 int returnVal= 0;
                                 try {
                                    returnVal = tools.getDatabase().executeRDB(aSQL, aList);
                                 }
                                catch (DatabaseException e) {
                                     oLog.error("Error in insert", e);
                                 }

Note: Here TESTPROPERTY is a property created on the example work class and is exposed.
4. Execute the activity and check logs.



Root Cause



A defect in Pegasystems’ code or rules.

Resolution



HFix-25399 resolves this issue.

 

Published March 1, 2016 - Updated October 8, 2020

Was this useful?

0% found this useful

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega Community has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice
Contact us