Does MySQL jdbc driver has built in support for database connection pools? (like Oracle has OracleDataSource class)
I did a thorough search but couldn't find any. I know that I can use external libraries such as dbcp or boneCp and also that application servers such as tomcat and jboss supports connection pools.
But I would be interested to know if MySQL does have it's own implementation of connection pools.
Thank in advance.
The JDBC specification (see in particular page 68) supports connection pooling, so any modern driver has that capability. However, the intention isn't for JDBC drivers to maintain their own connection pools; so whether you're using MySQL Connector/J or Oracle driver, you still need the connection pool implementation provided by an application server or a third party library.
Unless of course you want to try rolling your own. o.O
The relevant JDBC interfaces are javax.sql.ConnectionPoolDataSource and javax.sql.PooledConnection.
In the latest MySql driver, the corresponding implementation classes are MysqlConnectionPoolDataSource
and MysqlPooledConnection
(both in package com.mysql.jdbc.jdbc2.optional). You may find these code examples interesting - they're using a class called MiniConnectionPoolManager as the connection pool implementation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With