This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds and have James Denton on-line!
See this thread for details.
Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

timeout error  RSS feed

 
Ranch Hand
Posts: 358
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
At times I am getting the following error in my application - com.ibm.ejs.cm.pool.ConnectionWaitTimeoutException: Timeout waiting for free connection
I am using DataSource to connect to the oracle database. Ihave used this finally block to close the connection once its done. Is it necessary to close ResultSet and Statement objects also..??
 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You may use -
DriverManager.setLoginTimeout(seconds)
to increase the wait time
Also
Tune the connection pool and database as per requirements of your application
You may retry the getConnection() but is not advisible
conn.close() closes all your statements and resultsets automatically
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Parmeet Sarpal:
At times I am getting the following error in my application - com.ibm.ejs.cm.pool.ConnectionWaitTimeoutException: Timeout waiting for free connection
I am using DataSource to connect to the oracle database. Ihave used this finally block to close the connection once its done. Is it necessary to close ResultSet and Statement objects also..??


Hi Parmeet,
it is very important that you close your Statement and ResultSet objects.
You can get into big time trouble not doing it, especially - and that is for sure - if you are using a connection pool. Closing a Connection obtained from a connection pool does NOT close the connection and release all used resources. Consequence is that you will have a memory leak.
This is a very common error in JDBC programming.
Regards,
Taudo
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!