We're adapting an existing system that sets information inside the connection that is picked up by database triggers.
Currently the system gets a connection for a user and then passes it around all the methods to ensur that the same connection is used.
This connection has a user variable set when the connection is first obtained. When a trigger in the database is activated, it uses this value in one the columns in a row it inserts into a table.
Its actually an audit table and it is logging the change and who performed the change.
This uses an Oracle specific procedure called called DBMS_APPLICATION_INFO.SET_CLIENT_INFO.
We need to keep this feature. I am looking at passing the variable through using a ThreadLocal class but can't figure out how to set this when using Spring JDBC, which doesn't give you access to the connection, you only specify the datasource. As the datasource may change with each call, is there any way to intercept(?) the get connection and call the procedure to set the variable before the connection is used in the SPring JDBC statements?


Reply With Quote