When using the Database Connector with a pooling profile and operations utilizing a streaming strategy, database connections remain occupied until the result set is fully consumed. Under high request volumes, this can lead to connection exhaustion, resulting in the error: "An attempt by a client to checkout a Connection has timed out."
Consume the result set, e.g. using OBJECT TO JSON, after running the query. Once the result set is consumed, the connection will be released
If you are calling a Stored Procedure returning no result set, the solution is to disable streaming.
Consume the result set after running the query.
In the following example, the "Transform Message" operation is used as an example to consume the result set after the SELECT statement, which is a streaming component.
Before (the result set of the SELECT statement is not consumed):
<db:select doc:name="Select * from test" doc:id="c81a6931-16cf-43db-9959-25b71f4cc2be" config-ref="Database_Config">
<db:sql><![CDATA[SELECT count(*) as counter FROM demo]]></db:sql>
</db:select>
After (the "Transform Message" operation consumes the result set):
<db:select doc:name="Select * from test" doc:id="c81a6931-16cf-43db-9959-25b71f4cc2be" config-ref="Database_Config">
<db:sql><![CDATA[SELECT count(*) as counter FROM demo]]></db:sql>
</db:select>
<ee:transform doc:name="Transform Message" doc:id="70ef20e3-1817-48d8-9357-9166c938807b" >
<ee:message >
<ee:set-payload ><![CDATA[%dw 2.0
output application/json
---
payload]]></ee:set-payload>
</ee:message>
</ee:transform>
Note: If the transformation is using application/java, it will not help consume the payload and release the database connection.
output application/java --- payload
If the consumption of the result set is late in the flow or takes time and the connection pool gets maxed out due to a large number of requests, there are two options to consider:
1. Increase the "Max pool size" to a bigger number to accommodate the number of connections required
2. Send the result to a VM queue for asynchronous processing, allowing the database connection to be released back to the connection pool promptly.
For more details, refer to the knowledge article below:
001123772

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.