# connectPool

fun connectPool(datasource: ConnectionPoolDataSource, setupConnection: (Connection) -> Unit = {}, databaseConfig: DatabaseConfig? = null, manager: (Database) -> TransactionManager = { ThreadLocalTransactionManager(it) }): Database

### Deprecated (with error)

Use Database.connect() with a connection pool DataSource instead. This may be removed in future releases.

JDBC driver implementations of `ConnectionPoolDataSource` are not actual connection pools, but rather a means of obtaining the physical connections to then be used in a connection pool. It is a known issue, with no plans to be fixed, that `SQLiteConnectionPoolDataSource`, for example, creates a new connection each time instead of retrieving a pooled connection. Other implementations, like `PGConnectionPoolDataSource`, suggest that a `DataSource` or a dedicated third-party connection pool library should be used instead.

Please leave a comment on YouTrack with a use-case if your driver implementation requires that this function remain part of the API.

SQLiteConnectionPoolDataSource issue #1011

PGConnectionPoolDataSource source code

MysqlConnectionPoolDataSource source code