This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JDBC and the fly likes Connectionpool Active connection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Connectionpool Active connection" Watch "Connectionpool Active connection" New topic

Connectionpool Active connection

Shilpa Nandiv

Joined: Oct 29, 2012
Posts: 6
Please tell me the javacode that is,Iam using tomcat.jdbc.connectionpool.So using javacode how can i get how many connection running,sleeping and close and also active connection in program.

How can we confirm that how many connection active in program.I searched but not got any answer please tell me

Paul Clapham

Joined: Oct 14, 2005
Posts: 18541

I expect you saw the documentation page here?

Well, there's a code example near the bottom of that page. It creates a org.apache.tomcat.jdbc.pool.DataSource object; check out the API documentation for that class here:

If you look through that API documentation long enough (and there's a big list of methods to go through) you'll see there are methods like getNumActive(), getNumIdle(), and so on. Was that what you were looking for?
Shilpa Nandiv

Joined: Oct 29, 2012
Posts: 6
Hi Paul,

I want to know about connection,when web application running it will use so many connection.But i want to no how many connection are using,and sleeping all information.So how can i get this information in program or some other method are there to check tomcat.apache.jdbc.connection pool.Please tell me

Shilpa Nandiv

Joined: Oct 29, 2012
Posts: 6

I am using tomcat7 in that using javacode i want to know

What I am looking for are the following items.

Show that there are defined number of active connections in the application.

Any additional request will add to the pool. If they get into sleep mode, the pool reduces back to predefined value.

Any release of connection will reduce from the pool.

An established connection stays connected until the started task is not completed.

so please tell me how can do.

Consider Paul's rocket mass heater.
subject: Connectionpool Active connection
Similar Threads
how to connect FTP server in java
Reg : How to get the No.of Active ConnectionPools?
Exact Difference Between LinkedList and ArrayList
how to make connection by using mysql
Basic Doubts