-
1. Re: Connection being referenced from previous thread/transaction
andey Oct 22, 2017 3:30 AM (in response to rveleda)1# Apply the below datasource connection validation:
<validation>
<validate-on-match>true</validate-on-match>
<valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLValidConnectionChecker"></valid-connection-checker>
<exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLExceptionSorter"></exception-sorter>
</validation>
2# You should have to set "idle-timeout-minutes" with the appropriate values:
<timeout>
<idle-timeout-minutes>30</idle-timeout-minutes> <!-- for example, by default 30 minutes-->
</timeout>
3#Application code must handle exceptions that arise while a connection is held (InUse) by the application component
Upon completion of connection usage (even if the connection has failed), the application code must explicitly call Connection.close() to return the connection to the pool..
You should close all the opened resources (like Connection, sessions, Statement, ResultSet, PreparedStatement, CallableStatement) properly in finally block of the individual methods instead of in the try block and close the connection object in the finally block of the parent method.