db.connection-pool
Database connection pool management using C3P0.
close-pool!
(close-pool! datasource)Closes the provided C3P0 datasource pool.
Takes a ComboPooledDataSource and shuts it down gracefully. Logs the closure and any errors that occur. Returns nil. If the datasource is not a ComboPooledDataSource instance, does nothing.
create-pool
(create-pool db-url)(create-pool db-url opts)Creates and returns a C3P0 ComboPooledDataSource connection pool.
Takes a JDBC database URL string (which should contain necessary credentials) and an optional map of C3P0 configuration overrides. Automatically configures the pool to use virtual threads via the c3p0-loom library’s VirtualThreadPerTaskExecutorTaskRunnerFactory.
When called with just a URL, uses default C3P0 settings. When called with both URL and options, merges the provided options with the defaults. Returns the created ComboPooledDataSource connection pool, or throws an Exception if pool creation fails.