Wednesday 29 August 2012

Connection Pool

Use of Connection Pool - A connection pool is used to minimize the number of connections opened between application and database. It serves as a librarian, checking out connections to application code as needed. Much like a library, your application code needs to be strict about returning connections to the pool when complete, for if it does not do so, your application will run out of available connections.

Problem in Pooling : When using connection pooling, it is important to remember that a chunk of bad code that neglects to return connections can starve the rest of the application, causing it to eventually run out of connections and hang (potentially failing nowhere near the actual problem).

Avoidance of Poling: This problem can be avoided by always using a finally block to close your connection, as shown throughout this book.

No comments:

Post a Comment