and on still others (PostgreSQL) it is simply not possible.
But just so you know, it is not as inefficent as you might think. We have one user that has literally several thousand pools in the same JVM. Granted, you should probably set minimumIdle to 0 in this case, and a fairly aggressive idleTimeout.
Then flip it around, implement the wrapper DataSource to delegate to PostgreSQL JDBC, on getConnection() delegate to them, then call setSchema(). Configure your wrapper DataSource as the data source that HikariCP should call for connections.
| public final Connection getConnection(final long hardTimeout) throws SQLException Does final PoolBagEntry bagEntry = connectionBag.borrow(timeout, TimeUnit.MILLISECONDS); and returns return ProxyFactory.getProxyConnection((HikariPool) this, bagEntry, leakTask.start(bagEntry)); Somewhere in between we need to do setSchema on the connection ... |