From your Mule API, you are connecting to an MS SQL Server DB and using a Pooling Profile in your DB connector configuration, and intermittently observe the error "Could not find prepared statement with handle 1." as demonstrated in these sample logs:
Route 0: ******************************************************************************** Message : 'until-successful' retries exhausted Element : CRGUpdateDeliveryStatusPending/processors/1 @ allegis-prod-crgdatapoller:subflows/db-calls.xml:96 (Until Successful) Element DSL : (None) Error type : (None) Caused by : DB:BAD_SQL_SYNTAX: Could not find prepared statement with handle 1. FlowStack : (None) Payload Type : org.mule.runtime.core.api.util.CaseInsensitiveHashMap -------------------------------------------------------------------------------- Root Exception stack trace: com.microsoft.sqlserver.jdbc.SQLServerException: Could not find prepared statement with handle 1. at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:265) at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1695) at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:620) at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:539) at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:7685) at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:4048) at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:272) at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:246) at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeUpdate(SQLServerPreparedStatement.java:484) at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:1502)
When the AnyPoint Database Connector throws the error 'Could not find prepared statement with handle 1', the cause can be from having a Pooling profile and PreparedStatementCache configured.
It has been observed that disabling the PreparedStatementCache (i.e, setting it to 0) resolves the issue. As usual, kindly make sure your application is performance tested properly when you make changes in your Pooling profile.
Disclaimer: This article involves products and technologies which do not form part of the MuleSoft product set. Technical assistance for such products is limited to this article. This solution provides a suggestion that should be considered in conjunction with your specific use case and requirements and does not represent a complete solution for all circumstances.
001123674

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.