Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 355171 - Executing JDBC statements using DatabaseAccessor in SessionEventListener.preReleaseConnection with external pool causes infinte loop
Summary: Executing JDBC statements using DatabaseAccessor in SessionEventListener.preR...
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P2 normal (vote)
Target Milestone: ---   Edit
Assignee: Nobody - feel free to take it CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-18 17:26 EDT by Doug Clarke CLA
Modified: 2022-06-09 10:20 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Doug Clarke CLA 2011-08-18 17:26:06 EDT
When invoking a JDBC statement within SessionEventListener.preReleaseConnection with an external pool the execute call on the DatabaseAccessor results in a call to the preReleaseConnection event. This results in an infinte loop.

PROBLEM CODE:

    @Override
    public void preReleaseConnection(SessionEvent event) {
        DatabaseAccessor accessor = (DatabaseAccessor) event.getResult();
        SQLCall call = new SQLCall("CALL DBMS_SESSION.CLEAR_IDENTIFIER()");
        call.returnNothing();
        accessor.executeCall(call, new DatabaseRecord(), (AbstractSession) event.getSession());
    }

 
WORK-AROUND:

    @Override
    public void preReleaseConnection(SessionEvent event) {
        DatabaseAccessor accessor = (DatabaseAccessor) event.getResult();
        execute((AbstractSession) event.getSession(), accessor, "CALL DBMS_SESSION.CLEAR_IDENTIFIER()");
    }

    private void execute(AbstractSession session, DatabaseAccessor accessor, String sql) {
        try {
            PreparedStatement statement = accessor.getConnection().prepareStatement(sql);
            statement.executeUpdate();
        } catch (SQLException e) {
            throw new RuntimeException("OracleVPDListener::" + sql + " FAILED", e);
        }
        session.log(new SessionLogEntry(SessionLog.FINE, SessionLog.SQL, session, sql, new String[0], accessor, false));
    }
Comment 1 Tom Ware CLA 2011-09-09 09:05:52 EDT
Setting target and priority.  See the following page for the meanings of these fields:

http://wiki.eclipse.org/EclipseLink/Development/Bugs/Guidelines

Community: Please vote for this bug if it is important to you.  Votes are one of the main criteria we use to determine which bugs to fix next.
Comment 2 Eclipse Webmaster CLA 2022-06-09 10:20:48 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink