Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Connection pool errors

 
Punya Pratap Singh
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am creating a Database connection pool in my application(With Tomcat Server). I am using org.apache.tomcat.jdbc.pool. but my applications requirement is to configure databse connection pool properties in external xml file (I can not use server.xml or context.xml).I am configuring pool configuration in custom xml file and put it in tomcat/conf/appname/appname.xml file
I am doing it so that we can change data base configuration at runtime with out restarting the server.



I have created connection pool in contextInitialized() method. and using DataSource I am getting connections from this database pool.
But everytime if I make multiple requests to application. it sometimes give "pool exhausted exception", connection is already closed or Timeout: Pool empty. Unable to fetch a connection in x seconds, none available.
But if I use tomcat context.xml, it doesn't give any error and works well for multiple requests.

I am closing ResultSet, Statement and connection objects properly in the code.
Also I have read somewhere that I am closing proxy connections not real connection .


Please help me.



 
Jhonson Fernando
MyExamCloud Software Support
Ranch Hand
Posts: 692
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check your maximum connection size from both your database and connection pool settings.
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!