Difference between version and version      View first change»»

Back to DatabaseConnectionAndPoolingQuestions, or DatabaseConnectionAndPoolingQuestions version history

At line 1 added 4 lines.
[{ALLOW edit neale}]
[{ALLOW upload neale}]
[{ALLOW rename neale}]
[{ALLOW view Anonymous,Asserted,Authenticated}]
At line 7 added 6 lines.
!What is a Connection Pool?
When connecting to a database, a network connection needs to be established. This takes time, and if an area of code is called multiple times without using the same connection, the time delay becomes very noticeable.
A better solution is to use a connection pool (see [DBCP]), and be sure to close connections when you are finished with them. This also provides a large performance boost, because connections can be re-used.
\\
At line 5 changed 1 line.
No, physical database connections will only free up if the java object is destroyed.
You must always call Connection.close() when using a connection pool. Physical database connections will only free up if the java object is destroyed.
At line 19 added 2 lines.
* __Warning:__ if you do not close connections, a [Connection Leak] will occur, and your pool will run out of connections. When this happens, your application will pause indefinitely waiting for a connection to be freed up, and will need to be restarted manually.
\\
At line 10 removed 3 lines.
A better solution is to use a connection pool (see [DBCP]), and close connections when you are finished with them. This also provides a large performance boost, because connections can be re-used.
At line 42 added 7 lines.
!What are the benefits of connection pooling?
* Connection details (username/password/URL) are all managed from a single location. This prevents duplication all through your code, which increases portability and makes moving between the development, test and production environments easier.
* Connections are re-used, providing a significant performance increase to your application
* Resource usage is less, providing increased server performance
navigation
metawerx specific
search
Share
tools
help

referring pages

Share