> We are working on Bean Managed Persistent Entity Beans. We
> got a mail now
> from our DBA that there are around 200 sessions open in the
> Oracle Server.
> This could be because our connection.close statements don't
> work or maybe
> don't get called. Could anyone tell me which is the right place in an
> Entity Bean to:
> 1. Open Connection

Immediately before you start using it.

> 2. Close Connection
>

Immediately after you finish using it.

This means a business method looks something like

void businessMethod(args) {
    Connection conn = null;
    try {
         conn = acquireConnection();
         // JDBC access (do not issue a commit)
    } finally {
        try { conn.close(); } catch (Exception ignore) {}
    }
}

In case it looks inefficient, don't worry: the app server will pool the
connections, and only a few will be actually opened.

Getting the connections in setEntityContext is wrong transaction-wise as
well as inefficient.

- Avi
--
s/\be(\w+)/e-\1/g;

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to