#19 support for init sql run once after connection created

open
nobody
5
2009-12-10
2009-12-10
Hal Deadman
No

Pools in weblogic have a nice feature called "init sql" that will run a statement when the connection is created. We use the feature to run a command like this in Oracle when the pool creates a connection:

alter session set current_schema=TABLE_OWNER_SCHEMA

where TABLE_OWNER_SCHEMA is the schema containing most of the application's tables. Our applications need to login as a user that doesn't own the tables and being able to run this command once on connection creation allows us to avoid hard coding schema names in the application's SQL and it avoids the DBA needing to maintain public or private synonyms.

It isn't appropriate to call this every time a user calls getConnection() from a pool so it needs to be done in the pool when the connection is actually created.

commons-dbcp has this feature checked in but I don't know if they will ever do a 1.3 release.

Discussion