my dog learned polymorphism
The moose likes JDBC and Relational Databases and the fly likes JDBC Connection Pool behaviour Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "JDBC Connection Pool behaviour" Watch "JDBC Connection Pool behaviour" New topic

JDBC Connection Pool behaviour

Gabriel Beres
Ranch Hand

Joined: Sep 09, 2006
Posts: 61

I use JDBC Connections as threadlocal variables. I get the connections from pool (UCP).
Let's assume my application has two threads which are performing many database operations.

In this case i would assume that my used connection count cannot go over 2. In reality it does.
What could be the explanation for this?

Jan Cumps

Joined: Dec 20, 2006
Posts: 2549

How have you configured your pool? Min, max, ...

OCUP UML fundamental and ITIL foundation
Gabriel Beres
Ranch Hand

Joined: Sep 09, 2006
Posts: 61

Min 1
Max 5
Kuldip Shetty
Ranch Hand

Joined: Jan 07, 2010
Posts: 42

Each time you fetch connection from the pool after performing db operation verify if the connection is released back to the pool by performing connection.close()
I agree. Here's the link:
subject: JDBC Connection Pool behaviour
It's not a secret anymore!