1 Reply Latest reply on Jun 24, 2008 9:12 AM by Vicky Kak

    Connection handle is not associated with the Managed Connect

    Ramkumar Krishnan Newbie

      Hi All,
      I am running my batch application in jboss 4.2.2. I am getting the below exception frequently though not every time i run the batch job. I am using spring 2.5.4 and spring-batch 1.0.1. My database is Mysql 5.1.23.

      org.springframework.jdbc.UncategorizedSQLException : PreparedStatementCallback; uncategorized SQLException for SQL [SELECT COUNT(*) FROM BATCH_JOB_EXECUTION WHERE JOB_EXECUTION_ID = ?]; SQL state [null]; error code [0]; Connection handle is not currently associated with a ManagedConnection; nested exception is java.sql.SQLException: Connection handle is not currently associated with a ManagedConnection


      I am using HibernateTransactionManager (Hibernate 3.2) in my application.

      This is my mysql-ds.xml
      <local-tx-datasource>
      
       <jndi-name>DarkDS</jndi-name>
       <connection-url>jdbc:mysql://10.52.91.72/dh_r5</connection-url>
       <driver-class>com.mysql.jdbc.Driver</driver-class>
       <user-name>ou_user</user-name>
       <password>chi12#$</password>
      
       <new-connection-sql>select 1 from dual</new-connection-sql>
       <check-valid-connection-sql>select 1 from dual</check-valid-connection-sql>
       <background-validation>true</background-validation>
      
       <min-pool-size>50</min-pool-size>
      
       <max-pool-size>50</max-pool-size>
       <prepared-statement-cache-size>500</prepared-statement-cache-size>
      
       <idle-timeout-minutes>5</idle-timeout-minutes>
       <exception-sorter-class-name> com.mysql.jdbc.integration.jboss.ExtendedMysqlExceptionSorter</exception-sorter-class-name>
       <valid-connection-checker-class-name> com.mysql.jdbc.integration.jboss.MysqlValidConnectionChecker </valid-connection-checker-class-name>
      <connection-property name="useOldAliasMetadataBehavior">true</connection-property>
      
       </local-tx-datasource>
      


      Do i need to change something in my ds.xml ? I checked the jboss documentation but i couldn't find any info on this issue

      Any fixes?

      Please let me know if you need more information from me. I badly need a fix for this.

      thanks in advance,
      Ram