Database Connector Troubleshooting - Mule 4

To troubleshoot Anypoint Connector for Database (Database Connector), review the following causes and possible solutions.

Pooling Profiles Connections Making the Flow Hang

Using a pooling profile that provides fewer connections than what the flow uses can make the entire flow hang.


One solution is to increase the size of the pool. However, sometimes that’s not possible, so another solution is to use the VM Connector to shorten the life of the connection to be the same as the life of a VM message. This way, every call to the Stored procedure operation is executed, its result is consumed, and the connection associated with the operation is closed and returned to the pool.

The following example shows how to use pooling profiles with the Stored procedure operation and VM Connector. When the foreach element reaches the eleventh iteration the Stored procedure operation won’t hang since the pool is able to provide a connection:

	<db:config name="Database_Config">
		<db:generic-connection url="someUrl" user="someUser" password="somePassword" driverClassName="someDriver">
			<db:pooling-profile maxPoolSize="10">

	<vm:config name="VM_Config">
		<vm:queues >
			<vm:queue queueName="testQueue" />

	<flow name="processingFlow">
		<foreach collection="#[1 to 11]">
			<logger level="INFO" message="#['Starting Iteration ' ++ payload as String]" />
			<vm:publish config-ref="VM_Config" queueName="testQueue"/>
			<logger level="INFO" message="#['Finishing Iteration ' ++ payload as String]"/>

	<flow name="coolFlow">
		<vm:listener config-ref="VM_Config" queueName="testQueue" numberOfConsumers="1"/>
		<db:stored-procedure config-ref="Database_Config">
				<db:sql><![CDATA[{call testProc2()}]]></db:sql>
		<logger level="INFO" message="#[output application/json --- payload.resultSet1]" />