5

What's the difference between MysqlConnectionPoolDataSource and C3p0, BoneCP or dbcp library for connection pooling? I don't understand why use a library if mysql connector give connection pooling.

Nicolas
  • 53
  • 3
  • Here are some more details about what might best suit your needs http://stackoverflow.com/questions/5640146/java-jdbc-connection-pool-library-choice-in-2011-2012 – Franz Kafka Apr 12 '13 at 09:20

1 Answers1

4

A ConnectionPoolDataSource is not a connection pool (or at least: it shouldn't be), it is intended to be used by a DataSource that provides pooling (eg from an application server). A ConnectionPoolDataSource provides the physical connections that will be held in the connection pool. Besides creating those physical connections a ConnectionPoolDataSource shouldn't do anything else.

So if you are working in an application server, use the pooling provided by the DataSources of the application server. If you are in a standalone application or a server that doesn't provide datasources on its own, use third party connection pools like BoneCP, c3p0 or Apache DBCP. If MySQL also provides a normal DataSource that provides pooling, then you could use that.

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197