1 Reply Latest reply on Apr 16, 2012 5:21 PM by peterj

    JBoss connection pooling

    sweth_smile

      Hi All,

      I am new to JBoss AS. I am using Jboss connection pooling to connect to MS- SQL DB.

      In my code first i am getting a new connection, and i execute the query and get the results. But i didnt close the connection explictly.

      During second call to the code i am checking whether  the connection obj is null if so i am creating a new connection else i am resuing the existing connection.

      My questions are:

      1. What will happen to a connection after i execute a query and didnt issue close? How long will it be active and what will be its state?

      2. how will jboss release a connection from pool?

       

      Please advise on the same

      Thanks

      -Swetha

        • 1. Re: JBoss connection pooling
          peterj

          Which version of JBoss AS? I think that 7.x bechaves somewhat differnetly that earlier versions. But if you mean 6.x or earlier, there are some thoughts:

           

          * If you fail to close a connection when you app responds to a request, the app server will "close" the connection for you. (There should be a log message about this)

          * Closing a connection really means "placing the connection back into the connection pool"

          * Opening a connection really means "obtaining a connection from the connection pool"

          * No physical connections are made to the database until a connection is requested. At that time min-pool-size physical connections are created and placed into the pool, one ofwhich is returned to the requester.

          * If a connection remains unused for idle-timeout-minutes, it is physically closed and removed from the pool. (If that causes less than min-pool-size connections to be open, a new physical connection is opened and added to the pool.)