connection-poolingdatabase-schemamulti-tenantbonecp

BoneCP, other connection pools and the ability to switch Schemas


I am laying the ground work for a multi-tennant application. Our strategy on the database side is to have some schemas shared (properties, persmissions and other non-tenant data) and have each tenant have their own schema. (This is not a question on the merits of that decision).

I am looking for a Connection Pool which like Oracles Universal Connection (UCP) Pool allows me to set the schema on the connection that I retrieve. For the sake of this discussion, lets assume that we have all schemas stored on one database cluster and are accessible by the same user context. I do not want to use Oracle's UCP. It has concurrency issues I am wanting to avoid and I am not using Oracle (but PostgreSQL instead).

Ideally I want to say 'Pool.getConnection(forSchema);'.

I can build a wrapper in front of BoneCP to achieve this, but I am hoping to avoid that.

BoneCP is currently selected by me because performance is a particular concern with this endeavor, so at this time I am still open to change this decision if some other connection pool natively allows for this behavior.

If I can achieve this with BoneCP so much the better - please illuminate me.

Thank you in advance.


Solution

  • I abondoned BoneCP for HikariCP. All needs are met.