What is connection pooling? What Method and class used for
Connection pooling in Java?

Answer Posted / qim2010

Connection pooling is the maintenance of a group of database
connections for reuse by applications on an application
server thus cutting down substantially on the number of new
connections that need to be created. It is part of the JDBC
2.0 Optional Package API. Another part of the Optional
Package API provides for the use of the Java Naming and
Directory Interface (JNDI) and DataSource objects instead of
JDBC 1.0 DriverManager objects to access relational data.

Connections made via a DataSource object that is implemented
to work with a middle tier connection pool manager will
participate in connection pooling. This can improve
performance dramatically because creating new connections is
very expensive.

Connection pooling is totally transparent. It is done
automatically in the middle tier of a J2EE configuration, so
from an application's viewpoint, no change in code is
required. An application simply uses the
DataSource.getConnection method to get the pooled connection
and uses it the same way it uses any Connection object.

The classes and interfaces used for connection pooling are:

ConnectionPoolDataSource
PooledConnection
ConnectionEvent
ConnectionEventListener

The connection pool manager, a facility in the middle tier
of a three-tier architecture, uses these classes and
interfaces behind the scenes. When a
ConnectionPoolDataSource object is called on to create a
PooledConnection object, the connection pool manager will
register as a ConnectionEventListener object with the new
PooledConnection object. When the connection is closed or
there is an error, the connection pool manager (being a
listener) gets a notification that includes a
ConnectionEvent object.

Is This Answer Correct ?    8 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What does the jdbc driver interface do?

569


What are the higher level apis under development on top of jdbc currently?

507


What is meant by jdbc and odbc?

498


What are the conditions applies to varchar variable, when using in procedures?

1626


What is the use of setFetchSize() and setMaxRows() methods in Statement?

533






What is sqlwarning and discuss the procedure of retrieving warnings?

567


Which database is used with java?

514


What are collection pools?

527


What do you mean by odbc?

560


Differentiate between a statement and a preparedstatement.

509


What is a statement in java?

521


What is difference between java.util.Date and java.sql.Date?

548


What is use of connection pooling?

534


What is isolation level? How to set it?

1653


What port does jdbc use?

507