Topic
  • 2 replies
  • Latest Post - ‏2014-03-27T20:32:49Z by JAntley
dhriti.developer
dhriti.developer
2 Posts

Pinned topic Connection pooling using Tomcat 7.0.47 and DB2 9.1

‏2014-03-26T12:06:41Z |

Connections does not returned to the pool, the size of the connection pool increases more than the maxSize. I am using the DB2 9.1 and Tomcat 7.0.47.Also for database connectivity I have to use db2jcc.jar and db2jcc_license_cu.jar of DB2 9.5 as jars of DB2 9.1 does not work.I have close all my connections,statements used in the applications in finally block by using connection.close();statement.close();preparedStatement.close(); 

I am setting maxSize = "30" but when I see the database connection log it shows connection more than 30 and it increases to 100 and after that database gets locked. I am using Applet, Servlet & Javabeans (for business logic).

I have configure the Tomcat by changing the web.xmlcontext.xml and server.xml (which are at the conf directry of the server). The configurations are as follows

web.xml

</web-app>

<resource-ref>

      <description>DB2 Datasource example</description>
      <res-ref-name>jdbc/Datasourcename</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
    </resource-ref>
</web-app>

context.xml

<Context>
    <!-- Default set of monitored resources -->
    <WatchedResource>WEB-INF/web.xml</WatchedResource>    
<ResourceLink global="jdbc/Datasourcename" name="jdbc/Datasourcename" type="javax.sql.DataSource"/>
</Context>

server.xml

<GlobalNamingResources>
    <!-- Editable user database that can also be used by
         UserDatabaseRealm to authenticate users
    -->
    
<Resource name="jdbc/Datasourcename"
          auth="Container"
          type="javax.sql.DataSource"
          factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
          testWhileIdle="true"
          testOnBorrow="true"
          testOnReturn="false"
          validationQuery="SELECT 1"
          validationInterval="30000"
          timeBetweenEvictionRunsMillis="30000"
          maxActive="30"
          minIdle="1"
 maxIdle="10"
          maxWait="10000"
          initialSize="1"
          removeAbandonedTimeout="60"
     logAbandoned="true"
          removeAbandoned="true"
 abandonWhenPercentageFull="50"
 closeMethod="close"  
          minEvictableIdleTimeMillis="3000"
          jmxEnabled="true" 
 jdbcInterceptors="org.apache.tomcat.jdbc.pool.interceptor.ConnectionState;org.apache.tomcat.jdbc.pool.interceptor.StatementFinalizer"
          alternateUsernameAllowed="true" 
          driverClassName="com.ibm.db2.jcc.DB2Driver"
 username="USERNAME"
          password="PWD"
          url="jdbc:db2://192.168.1.1:50000/db"/>
 
  </GlobalNamingResources>

 

 

Updated on 2014-03-27T05:13:38Z at 2014-03-27T05:13:38Z by dhriti.developer
  • dhriti.developer
    dhriti.developer
    2 Posts

    Re: Connection pooling using Tomcat 7.0.47 and DB2 9.1

    ‏2014-03-27T05:14:37Z  

    pls someone help me on this

  • JAntley
    JAntley
    135 Posts

    Re: Connection pooling using Tomcat 7.0.47 and DB2 9.1

    ‏2014-03-27T20:32:49Z  

    pls someone help me on this

    The forum that you have posted your question in is intended for those having difficulty with the developerWorks web site itself.  You will probably have better results if you post your question in the developerWorks DB2 forum, which can be found at https://www.ibm.com/developerworks/community/forums/html/forum?id=11111111-0000-0000-0000-000000000842.  Hope this helps.