I have developed a web application and using Tomcat connection pool,Java code is triggering query to DB2 server, sometimes it runs fine and return the result, but sometime it hangs i.e. the query will run continuously without any clue. Then i have to restart the Tomcat server which resolves the problem and give successfull data from database, I'm using JNDI and have configured the paramaters in server.xml of tomcat server(6.x).
configuration in web.xml of application's war file:-
<resource-ref>
<description>DB Connection Pool </description>
<res-ref-name>jdbc/abcd</res-ref-name>
<res-type>javax.sql.DataSource </res-type>
<res-auth>Container </res-auth>
</resource-ref>
configuration in context.xml apache tomcat server:-
<ResourceLink global="jdbc/abcd" name="jdbc/abcd" type="javax.sql.DataSource" />
configuration in server.xml:-
<Resource name="jdbc/abcd" auth="Container" type="javax.sql.DataSource" username="zzzzz" password="zzzzz" driverClassName="com.ibm.db2.jcc.DB2Driver" url="jdbc:db2://IP:50000/MYDB" />
I've not configured any additional parameters like minIdle,maxIdle,maxWait and maxActive.
Please let me know about correct procedure of configuration which parameter i've to change in order to handle the connection properly.