|
Connection Check-out Procedure
|
Specify the procedure to return a valid SQL statement for that database which can be used to initialize the connection. One common case is to initialize Oracle Virtual Private Database (VPD)-based systems.
VPD is a method of doing row-level security. Complex security policies can be set to allow or deny access to subsets of data in a table. After the connection is made, often with a generic account, the client enables certain sets of access rights by setting a security context. In this case, the init procedure returns something like dbms_session.set_identifier('username'). This would then be executed on the connection, changing the privileges associated with that connection from the default to those associated with the username passed.
In addition, other parameters can be changed. A block like this might be returned by the init procedure: BEGIN dbms_session.set_identifier('username'); EXECUTE IMMEDIATE 'alter session set optimizer_index_cost_adj=10'; EXECUTE IMMEDIATE 'alter session set optimizer_index_caching=90'; EXECUTE IMMEDIATE 'alter session set "_complex_view_merging"=true'; END;
This example code is Oracle-specific. Others databases have similar functions.
The signature of theinit procedure should look like this: IN ds_name VARCHAR, OUT sqlText VARCHAR)
The code should be written such that the init procedure causes rights to be revoked if not called with the appropriate context.
|