Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Configuring Exclusive Isolated Client Sessions for Virtual Private Database (ELUG)"

m (New page: <div style="float:right;border:1px solid #000000;padding:5px">__TOC__ [[Special:Whatlinkshere/Configuring Exclusive Isolated Client Sessions for Virtual Private Database (ELUG)|Related Top...)
 
m
Line 2: Line 2:
 
[[Special:Whatlinkshere/Configuring Exclusive Isolated Client Sessions for Virtual Private Database (ELUG)|Related Topics]]</div>
 
[[Special:Whatlinkshere/Configuring Exclusive Isolated Client Sessions for Virtual Private Database (ELUG)|Related Topics]]</div>
 
This section describes the various components that you must configure before you can acquire an exclusive isolated client session from a server session.
 
This section describes the various components that you must configure before you can acquire an exclusive isolated client session from a server session.
 
[[#Table 88-1|Configurable Options for Isolated Client Sessions]] lists the configurable options for isolated sessions.
 
 
 
 
==Introduction to Exclusive Isolated Client Session Configuration==
 
  
 
This table lists the configurable options for isolated sessions.
 
This table lists the configurable options for isolated sessions.
 
  
 
<span id="Table 88-1"></span>
 
<span id="Table 88-1"></span>
''''' Configurable Options for Isolated Client Sessions'''''
 
 
 
{| class="RuleFormalMax" dir="ltr" title="Configurable Options for Isolated Client Sessions" summary="This table lists the configurable options common to Isolated Client Sessionsand categorizes them as Basic and Advanced and indicates if the option can be configured with the Workbench, Java, or both." width="100%" border="1" frame="border" rules="all" cellpadding="3" frame="border" rules="all"
 
{| class="RuleFormalMax" dir="ltr" title="Configurable Options for Isolated Client Sessions" summary="This table lists the configurable options common to Isolated Client Sessionsand categorizes them as Basic and Advanced and indicates if the option can be configured with the Workbench, Java, or both." width="100%" border="1" frame="border" rules="all" cellpadding="3" frame="border" rules="all"
 
|- align="left" valign="top"
 
|- align="left" valign="top"
Line 22: Line 13:
 
|- align="left" valign="top"
 
|- align="left" valign="top"
 
| id="r2c1-t2" headers="r1c1-t2" align="left" |
 
| id="r2c1-t2" headers="r1c1-t2" align="left" |
Cache isolation at the descriptor level (see [[Configuring%20a%20Descriptor%20(ELUG)#Configuring Cache Isolation at the Descriptor Level|Configuring Cache Isolation at the Descriptor Level]])
+
[[Configuring%20a%20Descriptor%20(ELUG)#Configuring Cache Isolation at the Descriptor Level|Configuring Cache Isolation at the Descriptor Level]]
 
| headers="r2c1-t2 r1c2-t2" align="left" |
 
| headers="r2c1-t2 r1c2-t2" align="left" |
 
[[Image:unsupport.gif|Unsupported]]<br>
 
[[Image:unsupport.gif|Unsupported]]<br>
Line 29: Line 20:
 
|- align="left" valign="top"
 
|- align="left" valign="top"
 
| id="r3c1-t2" headers="r1c1-t2" align="left" |
 
| id="r3c1-t2" headers="r1c1-t2" align="left" |
Connection policy (see [[Configuring%20a%20Session%20(ELUG)#Configuring Connection Policy|Configuring Connection Policy]])
+
[[Configuring%20a%20Session%20(ELUG)#Configuring Connection Policy|Configuring Connection Policy]]
 
| headers="r3c1-t2 r1c2-t2" align="left" |
 
| headers="r3c1-t2 r1c2-t2" align="left" |
 
[[Image:unsupport.gif|Unsupported]]<br>
 
[[Image:unsupport.gif|Unsupported]]<br>
Line 36: Line 27:
 
|- align="left" valign="top"
 
|- align="left" valign="top"
 
| id="r4c1-t2" headers="r1c1-t2" align="left" |
 
| id="r4c1-t2" headers="r1c1-t2" align="left" |
Oracle Database proxy authentication using Java (see [[Configuring%20a%20Database%20Login%20(ELUG)#How to Configure Oracle Database Proxy Authentication Using Java|How to Configure Oracle Database Proxy Authentication Using Java]])
+
[[Configuring%20a%20Database%20Login%20(ELUG)#How to Configure Oracle Database Proxy Authentication Using Java|How to Configure Oracle Database Proxy Authentication Using Java]]
 
| headers="r4c1-t2 r1c2-t2" align="left" |
 
| headers="r4c1-t2 r1c2-t2" align="left" |
 
[[Image:unsupport.gif|Unsupported]]<br>
 
[[Image:unsupport.gif|Unsupported]]<br>
Line 43: Line 34:
 
|- align="left" valign="top"
 
|- align="left" valign="top"
 
| id="r5c1-t2" headers="r1c1-t2" align="left" |
 
| id="r5c1-t2" headers="r1c1-t2" align="left" |
PostAcquiredExclusiveConnection event handler (see [[#Using PostAcquireExclusiveConnection Event Handler|Using PostAcquireExclusiveConnection Event Handler]])
+
[[#Using PostAcquireExclusiveConnection Event Handler|Using PostAcquireExclusiveConnection Event Handler]]
 
| headers="r5c1-t2 r1c2-t2" align="left" |
 
| headers="r5c1-t2 r1c2-t2" align="left" |
 
[[Image:unsupport.gif|Unsupported]]<br>
 
[[Image:unsupport.gif|Unsupported]]<br>
Line 50: Line 41:
 
|- align="left" valign="top"
 
|- align="left" valign="top"
 
| id="r6c1-t2" headers="r1c1-t2" align="left" |
 
| id="r6c1-t2" headers="r1c1-t2" align="left" |
PreReleaseExclusiveConnection event handler (see [[#Using PreReleaseExclusiveConnection Event Handler|Using PreReleaseExclusiveConnection Event Handler]])
+
[[#Using PreReleaseExclusiveConnection Event Handler|Using PreReleaseExclusiveConnection Event Handler]]
 
| headers="r6c1-t2 r1c2-t2" align="left" |
 
| headers="r6c1-t2 r1c2-t2" align="left" |
 
[[Image:unsupport.gif|Unsupported]]<br>
 
[[Image:unsupport.gif|Unsupported]]<br>
Line 57: Line 48:
 
|- align="left" valign="top"
 
|- align="left" valign="top"
 
| id="r7c1-t2" headers="r1c1-t2" align="left" |
 
| id="r7c1-t2" headers="r1c1-t2" align="left" |
NoRowsModifiedSessionEvent event handler (see [[#Using NoRowsModifiedSessionEvent Event Handler|Using NoRowsModifiedSessionEvent Event Handler]])
+
[[#Using NoRowsModifiedSessionEvent Event Handler|Using NoRowsModifiedSessionEvent Event Handler]]
 
| headers="r7c1-t2 r1c2-t2" align="left" |
 
| headers="r7c1-t2 r1c2-t2" align="left" |
 
[[Image:unsupport.gif|Unsupported]]<br>
 
[[Image:unsupport.gif|Unsupported]]<br>
Line 64: Line 55:
 
|- align="left" valign="top"
 
|- align="left" valign="top"
 
| id="r8c1-t2" headers="r1c1-t2" align="left" |
 
| id="r8c1-t2" headers="r1c1-t2" align="left" |
ValidationException handler (see [[#Using ValidationException Handler|Using ValidationException Handler]])
+
[[#Using ValidationException Handler|Using ValidationException Handler]]
 
| headers="r8c1-t2 r1c2-t2" align="left" |
 
| headers="r8c1-t2 r1c2-t2" align="left" |
 
[[Image:unsupport.gif|Unsupported]]<br>
 
[[Image:unsupport.gif|Unsupported]]<br>
Line 75: Line 66:
 
These options are used throughout the isolated session life cycle (see [[Introduction%20to%20EclipseLink%20Sessions%20(ELUG)#Isolated Client Session Life Cycle|Isolated Client Session Life Cycle]]).
 
These options are used throughout the isolated session life cycle (see [[Introduction%20to%20EclipseLink%20Sessions%20(ELUG)#Isolated Client Session Life Cycle|Isolated Client Session Life Cycle]]).
  
==Using PostAcquireExclusiveConnection Event Handler==
 
  
 +
 +
==Using PostAcquireExclusiveConnection Event Handler==
 
EclipseLink raises this event after an exclusive connection is allocated to an isolated session after the user has logged in to the database with it.
 
EclipseLink raises this event after an exclusive connection is allocated to an isolated session after the user has logged in to the database with it.
  
Line 90: Line 82:
 
|}
 
|}
  
<br>
+
 
 +
 
  
 
===How to Use Java===
 
===How to Use Java===
 
 
The <tt>SessionEvent.PostAcquireExclusiveConnection</tt> event listener is your opportunity to authenticate your user and interact with the underlying database platform: for example, to execute PL/SQL to create VPD packages and set VPD context information.
 
The <tt>SessionEvent.PostAcquireExclusiveConnection</tt> event listener is your opportunity to authenticate your user and interact with the underlying database platform: for example, to execute PL/SQL to create VPD packages and set VPD context information.
  
 
This example illustrates a typical session event listener used to handle <tt>postAcquireExclusiveConnection</tt> events for an isolated session.
 
This example illustrates a typical session event listener used to handle <tt>postAcquireExclusiveConnection</tt> events for an isolated session.
 
  
 
<span id="Example 88-1"></span>
 
<span id="Example 88-1"></span>
Line 114: Line 105:
  
  
To get the required user credentials, use <tt>ClientSession</tt> method <tt>getConnectionPolicy</tt> to get the associated <tt>ConnectionPolicy</tt>, and then use <tt>ConnectionPolicy</tt> method <tt>getProperty</tt>. The <tt>ConnectionPolicy</tt> associated with the <tt>ClientSession</tt> should contain all required user credentials (see [[Configuring%20a%20Session%20(ELUG)|Configuring Connection Policy]]).
+
To get the required user credentials, use <tt>ClientSession</tt> method <tt>getConnectionPolicy</tt> to get the associated <tt>ConnectionPolicy</tt>, and then use <tt>ConnectionPolicy</tt> method <tt>getProperty</tt>. The <tt>ConnectionPolicy</tt> associated with the <tt>ClientSession</tt> should contain all required user credentials (see [[Configuring%20a%20Session%20(ELUG)#Configuring Connection Policy|Configuring Connection Policy]]).
  
 
After you implement the required <tt>SessionEventListener</tt>, add it to the parent server session from which you acquire your isolated client session. For more information, see [[Configuring%20a%20Session%20(ELUG)#Configuring Session Event Listeners|Configuring Session Event Listeners]].
 
After you implement the required <tt>SessionEventListener</tt>, add it to the parent server session from which you acquire your isolated client session. For more information, see [[Configuring%20a%20Session%20(ELUG)#Configuring Session Event Listeners|Configuring Session Event Listeners]].
  
==Using PreReleaseExclusiveConnection Event Handler==
 
  
 +
 +
==Using PreReleaseExclusiveConnection Event Handler==
 
EclipseLink raises a <tt>SessionEvent.PreReleaseExclusiveConnection</tt> event after you call the isolated session method <tt>release</tt>.
 
EclipseLink raises a <tt>SessionEvent.PreReleaseExclusiveConnection</tt> event after you call the isolated session method <tt>release</tt>.
  
Line 125: Line 117:
  
 
If you are not using Oracle Database proxy authentication, then as part of the isolated session life cycle, you must implement a <tt>SessionEventListener</tt> for <tt>SessionEvent.PreReleaseExclusiveConnection</tt>.
 
If you are not using Oracle Database proxy authentication, then as part of the isolated session life cycle, you must implement a <tt>SessionEventListener</tt> for <tt>SessionEvent.PreReleaseExclusiveConnection</tt>.
 
<br>
 
  
 
{| class="Note oac_no_warn" width="80%" border="1" frame="hsides" rules="groups" cellpadding="3" frame="hsides" rules="groups"
 
{| class="Note oac_no_warn" width="80%" border="1" frame="hsides" rules="groups" cellpadding="3" frame="hsides" rules="groups"
Line 133: Line 123:
 
|}
 
|}
  
<br>
+
 
 +
 
  
 
===How to Use Java===
 
===How to Use Java===
 
 
The <tt>SessionEvent.PreReleaseExclusiveConnection</tt> event listener gives you an opportunity to interact with the underlying database platform: for example, to perform any VPD-specific cleanup such as executing PL/SQL to delete VPD packages or context information.
 
The <tt>SessionEvent.PreReleaseExclusiveConnection</tt> event listener gives you an opportunity to interact with the underlying database platform: for example, to perform any VPD-specific cleanup such as executing PL/SQL to delete VPD packages or context information.
  
Line 158: Line 148:
 
After you implement the required <tt>SessionEventListener</tt>, add it to the parent server session, from which you acquire your isolated client session. For more information, see [[Configuring%20a%20Session%20(ELUG)#Configuring Session Event Listeners|Configuring Session Event Listeners]].
 
After you implement the required <tt>SessionEventListener</tt>, add it to the parent server session, from which you acquire your isolated client session. For more information, see [[Configuring%20a%20Session%20(ELUG)#Configuring Session Event Listeners|Configuring Session Event Listeners]].
  
==Using NoRowsModifiedSessionEvent Event Handler==
 
  
 +
 +
==Using NoRowsModifiedSessionEvent Event Handler==
 
As part of your general error handling strategy, you should implement a <tt>SessionEventListener</tt> for <tt>SessionEvent.NoRowsModifiedSessionEvent</tt>.
 
As part of your general error handling strategy, you should implement a <tt>SessionEventListener</tt> for <tt>SessionEvent.NoRowsModifiedSessionEvent</tt>.
  
Line 172: Line 163:
 
{| class="Note oac_no_warn" width="80%" border="1" frame="hsides" rules="groups" cellpadding="3" frame="hsides" rules="groups"
 
{| class="Note oac_no_warn" width="80%" border="1" frame="hsides" rules="groups" cellpadding="3" frame="hsides" rules="groups"
 
| align="left" |
 
| align="left" |
'''Note:''' You must add this session event listener to the server session from which you acquire your isolated client session. You cannot add them to the isolated client session itself. For more information, see [[Configuring%20a%20Session%20(ELUG)|Configuring Session Event Listeners]]
+
'''Note:''' You must add this session event listener to the server session from which you acquire your isolated client session. You cannot add them to the isolated client session itself. For more information, see [[Configuring%20a%20Session%20(ELUG)#Configuring Session Event Listeners|Configuring Session Event Listeners]]
 
|}
 
|}
  
<br>
 
  
===How to Use Java===
 
  
 +
 +
===How to Use Java===
 
This event listener gives you an opportunity to determine whether the update failure was due to a security violation (in which case you should not retry the operation), or due to an optimistic lock issue (in which case a retry may be appropriate).
 
This event listener gives you an opportunity to determine whether the update failure was due to a security violation (in which case you should not retry the operation), or due to an optimistic lock issue (in which case a retry may be appropriate).
  
 
You can use the existing session event API, such as <tt>getQuery().getResult()</tt>, to get the affected object, if any.
 
You can use the existing session event API, such as <tt>getQuery().getResult()</tt>, to get the affected object, if any.
  
After you implement the required <tt>SessionEventListener</tt>, add it to the parent server session, from which you acquire your isolated client session. For more information, see [[Configuring%20a%20Session%20(ELUG)|Configuring Session Event Listeners]].
+
After you implement the required <tt>SessionEventListener</tt>, add it to the parent server session, from which you acquire your isolated client session. For more information, see [[Configuring%20a%20Session%20(ELUG)#Configuring Session Event Listeners|Configuring Session Event Listeners]].
  
  
  
 
==Using ValidationException Handler==
 
==Using ValidationException Handler==
 
 
As part of your general error handling strategy, your application should be prepared to handle a <tt>ValidationException</tt> of type <tt>ISOLATED_SESSION_IS_NO_LONGER_AVAILABLE</tt>.
 
As part of your general error handling strategy, your application should be prepared to handle a <tt>ValidationException</tt> of type <tt>ISOLATED_SESSION_IS_NO_LONGER_AVAILABLE</tt>.
  
Line 195: Line 185:
 
Fore more information, see the following:
 
Fore more information, see the following:
  
* [[Introduction%20to%20EclipseLink%20Sessions%20(ELUG)|Exception Handlers]]
+
* [[Introduction%20to%20EclipseLink%20Sessions%20(ELUG)#Exception Handlers|Exception Handlers]]
* [[Configuring%20a%20Session%20(ELUG)|Configuring an Exception Handler]]
+
* [[Configuring%20a%20Session%20(ELUG)#Configuring an Exception Handler|Configuring an Exception Handler]]
  
  

Revision as of 14:49, 17 December 2007

This section describes the various components that you must configure before you can acquire an exclusive isolated client session from a server session.

This table lists the configurable options for isolated sessions.

Option to Configure Workbench
Java

Configuring Cache Isolation at the Descriptor Level

Unsupported

Supported

Configuring Connection Policy

Unsupported

Supported

How to Configure Oracle Database Proxy Authentication Using Java

Unsupported

Supported

Using PostAcquireExclusiveConnection Event Handler

Unsupported

Supported

Using PreReleaseExclusiveConnection Event Handler

Unsupported

Supported

Using NoRowsModifiedSessionEvent Event Handler

Unsupported

Supported

Using ValidationException Handler

Unsupported

Supported


These options are used throughout the isolated session life cycle (see Isolated Client Session Life Cycle).


Using PostAcquireExclusiveConnection Event Handler

EclipseLink raises this event after an exclusive connection is allocated to an isolated session after the user has logged in to the database with it.

If you are using Oracle Database proxy authentication (see Oracle Database Proxy Authentication), then you do not need to implement this session event handler.

If you are not using Oracle Database proxy authentication, then, as part of the isolated session life cycle, you must implement a SessionEventListener for SessionEvent.PostAcquireExclusiveConnection.


Note: You must add this session event listener to the server session from which you acquire your isolated client session. You cannot add them to the isolated client session itself. For more information, see Configuring Session Event Listeners



How to Use Java

The SessionEvent.PostAcquireExclusiveConnection event listener is your opportunity to authenticate your user and interact with the underlying database platform: for example, to execute PL/SQL to create VPD packages and set VPD context information.

This example illustrates a typical session event listener used to handle postAcquireExclusiveConnection events for an isolated session.

Session Event Listener for an Isolated Session

class VPDEventListener extends SessionEventAdaptor{
    public void postAcquireExclusiveConnection(SessionEvent event){
        ClientSession session = (ClientSession)event.getSession();
        // Get property set on the ConnectionPolicy prior to acquiring the connection
        String userLevel = session.getConnectionPolicy().getProperty("userLevel");
        // Make the Stored Procedure call for VPD to set up the Context Information

        session.executeNonSelectingSQL("StoreProcSetContextUser("+ userLevel + ")");
    }
}


To get the required user credentials, use ClientSession method getConnectionPolicy to get the associated ConnectionPolicy, and then use ConnectionPolicy method getProperty. The ConnectionPolicy associated with the ClientSession should contain all required user credentials (see Configuring Connection Policy).

After you implement the required SessionEventListener, add it to the parent server session from which you acquire your isolated client session. For more information, see Configuring Session Event Listeners.


Using PreReleaseExclusiveConnection Event Handler

EclipseLink raises a SessionEvent.PreReleaseExclusiveConnection event after you call the isolated session method release.

If you are using Oracle Database proxy authentication (see Oracle Database Proxy Authentication), then you do not need to implement this session event handler.

If you are not using Oracle Database proxy authentication, then as part of the isolated session life cycle, you must implement a SessionEventListener for SessionEvent.PreReleaseExclusiveConnection.

Note: You must add this session event listener to the server session from which you acquire your isolated client session. You cannot add them to the isolated client session itself. For more information, see Configuring Session Event Listeners



How to Use Java

The SessionEvent.PreReleaseExclusiveConnection event listener gives you an opportunity to interact with the underlying database platform: for example, to perform any VPD-specific cleanup such as executing PL/SQL to delete VPD packages or context information.

This example illustrates a typical session event listener used to handle preReleaseExclusiveConnection events for an isolated session.


Session Event Listener for an Isolated Session

class VPDEventListener extends SessionEventAdaptor{
    public void preReleaseExclusiveConnection(SessionEvent event){
        Session session event.getSession();
        // Make the Stored Procedure call for VPD to reset the Context Information
        session.executeNonSelectingSQL("StoreProcResetContext()");
    }
}


To get the required user credentials, use ClientSession method getConnectionPolicy to get the associated ConnectionPolicy, and then use ConnectionPolicy method getProperty. The ConnectionPolicy associated with the ClientSession should contain all required user credentials (see Configuring Connection Policy).

After you implement the required SessionEventListener, add it to the parent server session, from which you acquire your isolated client session. For more information, see Configuring Session Event Listeners.


Using NoRowsModifiedSessionEvent Event Handler

As part of your general error handling strategy, you should implement a SessionEventListener for SessionEvent.NoRowsModifiedSessionEvent.

EclipseLink raises this event when an update or delete query is executed against the database, but no rows are updated, that is, a zero row count is returned.

If optimistic locking is not enabled and you query the database and violate your VPD security configuration, no exception is thrown: the query simply returns zero rows updated.

If optimistic locking is enabled and you query the database and violate your VPD security configuration, an OptimisticLockException is thrown even though the root cause of the failure was a security violation, not an optimistic locking issue.


Note: You must add this session event listener to the server session from which you acquire your isolated client session. You cannot add them to the isolated client session itself. For more information, see Configuring Session Event Listeners



How to Use Java

This event listener gives you an opportunity to determine whether the update failure was due to a security violation (in which case you should not retry the operation), or due to an optimistic lock issue (in which case a retry may be appropriate).

You can use the existing session event API, such as getQuery().getResult(), to get the affected object, if any.

After you implement the required SessionEventListener, add it to the parent server session, from which you acquire your isolated client session. For more information, see Configuring Session Event Listeners.


Using ValidationException Handler

As part of your general error handling strategy, your application should be prepared to handle a ValidationException of type ISOLATED_SESSION_IS_NO_LONGER_AVAILABLE.

EclipseLink throws an ISOLATED_SESSION_IS_NO_LONGER_AVAILABLE when a client triggers the indirection (lazy loading) on an isolated object when the isolated session used to load that object is no longer available, that is, after you call the isolated session method release.

Fore more information, see the following:



Copyright Statement

Back to the top