Answer Posted / bhudeep
With servlets, opening a database connection is a major
bottleneck because we are creating and tearing down a new
connection for every page request and the time taken to
create connection will be more.
Creating a connection pool is an ideal approach for
a complicated servlet. With a connection pool, we can
duplicate only the resources we need to duplicate rather
than the entire servlet. A connection pool can also
intelligently manage the size of the pool and make sure each
connection remains valid. A number connection pool packages
are currently available. Some like DbConnectionBroker are
freely available from
Java Exchange Works by creating an object that dispenses
connections and connection Ids on request.
The Connection Pool class maintains a Hastable,
using Connection objects as keys and Boolean values as
stored values. The Boolean value indicates whether a
connection is in use or not. A program calls getConnection
( ) method of the ConnectionPool for getting Connection
object it can use; it calls returnConnection ( ) to give the
connection back to the pool.
Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
What is the difference between ojdbc6 and ojdbc7?
What is statement and resultset in jdbc?
How can I retrieve a String or other object type without creating a new object each time?
What is use of connection pooling?
Name the types of jdbc drivers.
How the JDBC application works?
What is type 4 jdbc driver?
What is addbatch jdbc?
what is the meaning of following code snippets Class c=class.forName(driverClassName); Driver d=(driver)c.newInstance();
Name the method, which is used to prepare a callablestatement.
What causes no suitable driver error?
What is java soft framework?
Why should we close database connections in java?
What does executeupdate return in java?
How can I connect mysql or oracle with java?