To connect to database I have to use db2jcc.jar & db2jcc_license_cu.jar of DB2 9.5 as jars of 9.1 does not work properly.
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 also close all my connections,statements in my applications.
I have configure the Tomcat by changing the `web.xml`, `context.xml` and `server.xml` (which are at the conf directry of the server). The configurations are as follows
**web.xml**
Expand|Select|Wrap|Line Numbers
- <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>
Expand|Select|Wrap|Line Numbers
- <Context> <ResourceLink name="jdbc/datasourcename" global="jdbc/datasourcename" type="javax.sql.DataSource" /> </Context>
Expand|Select|Wrap|Line Numbers
- <GlobalNamingResources> <Resource name="UserDatabase" auth="Container"
- type="org.apache.catalina.UserDatabase"
- description="User database that can be updated and saved"
- factory="org.apache.catalina.users.MemoryUserDatab aseFactory"
- pathname="conf/tomcat-users.xml" /> <Resource name="jdbc/datasourcename" auth="Container"
- type="javax.sql.DataSource"
- factory="org.apache.tomcat.jdbc.pool.DataSourceFac tory"
- testWhileIdle="true"
- testOnBorrow="true"
- testOnReturn="false"
- validationQuery="SELECT 1"
- validationInterval="30000"
- timeBetweenEvictionRunsMillis="30000"
- maxActive="30"
- minIdle="1"
- maxWait="10000"
- initialSize="1"
- removeAbandonedTimeout="60"
- logAbandoned="true"
- removeAbandoned="true"
- closeMethod="close"
- abandonWhenPercentageFull="60"
- minEvictableIdleTimeMillis="3000"
- jmxEnabled="true" jdbcInterceptors="org.apache.tomcat.jdbc.pool.inte rceptor.ConnectionState;org.apache.tomcat.jdbc.poo l.interceptor.StatementFinalizer"
- alternateUsernameAllowed="true"
- username="user"
- password="pass"
- driverClassName="com.ibm.db2.jcc.DB2Driver"
- url="jdbc:db2:://127.0.0.1:50000/DBname" /> </GlobalNamingResources>