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 feature of jdbc v4?
What happens if connection is not closed in jdbc?
How can I know when I reach the last record in a table, since JDBC doesn't provide an EOF method?
What is JDBC Savepoint? How to use it?
Briefly tell about the jdbc architecture.
What is correlated subquery?
Differentiate between stored procedure and functions?
Why is odbc needed?
Is jdbc open source?
How can we execute stored procedures using callablestatement?
What are temp tables ?
What is difference between odbc and jdbc?
How many types of JDBC Drivers are present and what are they?
How can I get or redirect the log used by DriverManager and JDBC drivers?
please tell me the name and url path for type-4 driver ?