1 Reply Latest reply on Mar 21, 2008 1:10 AM by jaikiran pai

    Jboss connection pool doesn't release the connections

    Luciano Molinari Newbie

      Guys, i'm writting an application using JBoss and JNDI to make the access and the pool to the database. But i'm with a serious problem, because Jboss isn't releasing the connections. This problem occours especifically in a Quartz Job, that runs to each X minutes, e.g., in the most times this job runs, it creates a process(connection) to access de DB, but it doesn't release this process, stay there forever. This Job is save in the DB, e.g., isn't configured by xml. How i'm doing:


       <!-- sql to call when connection is created. Can be anything, select 1 is valid for PostgreSQL
       <new-connection-sql>select 1</new-connection-sql>
       <!-- sql to call on an existing pooled connection when it is obtained from pool. Can be anything, select 1 is valid for PostgreSQL
       <check-valid-connection-sql>select 1</check-valid-connection-sql>
       <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
       <type-mapping>PostgreSQL 7.2</type-mapping>

       <bean id="dataSource"
       <property name="jndiName" value="java:PostgresDS" />
       <bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
       <ref bean="dataSource" />
       <bean id="daoSpring" class="..DAOSpring">
       <property name="jdbcTemplate" ref="jdbcTemplate"/>
       <bean id="service" class="..Service">
       <property name="dao" ref="daoSpring"/>

      And then in the Job:

       ApplicationContext factory = new ClassPathXmlApplicationContext("/WEB-INF/applicationContext.xml");
       Service service = (Service)factory.getBean("service");

      I've already tried to change the datasource configuration, changed de kind from "local" to "xa", looked for a lot of things about it on net, but i'm not really been able to solve this problem. Does anyone has any idea about something that could help me?

      Thaks very much and sorry for the english.

        • 1. Re: Jboss connection pool doesn't release the connections
          jaikiran pai Master

          JBoss maintains a pool of connections. When an application requests for a connection from the datasource, the server returns a connection from this pool. The application then has to call the close method on the connection so that the connection is returned back to the pool (where it continues to stay). Is your application calling the close method on the connection, once it is done with whatever processing it does?