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

Facing '.pyCommitError: ** Database save using an insert failed'

SA-566

Summary



User is trying to enter a long text with a multi-byte character (smart quote( ’ )) in a field by doing a copy-paste from another file then facing '.pyCommitError: ** Database save using an insert failed' error in UI.

Error Messages


On UI:
.pyCommitError: ** Database save using an insert failed
In the log:

a. SQLState 72000, Error code 1461: java.sql.SQLException: ORA-01461: can bind a LONG value only for insert into a LONG column
This exception is occurring if the column size of “PYMEMO” in database is equal to 4000 bytes.

b. SQLState 72000, Error code 12899: java.sql.SQLException: ORA-12899: value too large for column "V63SP1USER_USER"."PC_HISTORY_TESTORG_TESTD_D4BB0"."PYMEMO" (actual: 263, maximum: 255)
This exception is occurring if the column size of “PYMEMO” in database is less than 4000 bytes.


Steps to Reproduce



1. Configure the application to store the content of a property in a history table for audit trail.

2. Enter  long text greater than the size of the database column width of the related property. Copy and paste one or more multi-byte characters,
such as the smart quote( ’ ) into the field in the first 255 characters.

Root Cause



PRPC will only try to assess any string pasted in by the number of characters, and doesn’t parse the values to systematically check the characters that make up each string.

Resolution


A validation can be used to strip any special characters from the property in question before the instance is saved to the database.

In this case for example, perhaps a Rule-Edit-Input could be configured on the field in question to convert smart quotes into “regular” quotes.

The below code can be used to configure the Rule-Edit-Input:

// replace curly quotes with straight quotes for db compatibility
theValue = theValue.replaceAll("[\\u0093\\u0094\\u201c\\u201d]", "\"");
theValue = theValue.replaceAll("[\\u0091\\u0092\\u2018\\u2019]", "'");

//replace html quote entities with quotes
theValue = theValue.replaceAll("'", "'");
theValue = theValue.replaceAll(""", "\"");
Suggest Edit

Published June 12, 2015 - Updated October 8, 2020

Did you find this content helpful? Yes No

Have a question? Get answers now.

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

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