looks good.
Don't forget the rollback in the catch and it should work.

Cyrille

----- Mail Original -----
De: "sic" <[email protected]>
À: [email protected]
Envoyé: Jeudi 11 Mars 2010 04h56:47 GMT +01:00 Amsterdam / Berlin / Berne / 
Rome / Stockholm / Vienne
Objet: Re: [dbcp] Re: Oracle session excess over maxActive


I just manage connections by raw code.

simple pseudo-code is that :

private DataSource ds;

public void test() {
        Connection conn = null;
        PreparedStatement pstmt = null;
        ResultSet rs = null;
        try {
                conn = ds.getConnection();
                pstmt = conn.prepareStatement(sql);
                rs = pstmt.executeQuery();
                ...
                conn.commit();
        } catch (Exception e) {
                ...
        } finally {
                if (rs != null) { try { rs.close(); } catch (SQLException e) { 
} }
                if (pstmt != null) { try { pstmt.close(); } catch (SQLException 
e) { } }
                if (conn != null) { try { conn.close(); } catch (SQLException 
e) { } }
        }
}

if using Spring's JDBC stuff as you mentioned, pseudo is following in my
thought :

        try {
                conn = DataSourceUtils.getConnection(ds);
                pstmt = conn.prepareStatement(sql);
                rs = pstmt.executeQuery();
                ...
                conn.commit();
        } catch (Exception e) {
                ...
        } finally {
                JdbcUtils.closeResultSet(rs);
                JdbcUtils.closeStatement(pstmt);
                DataSourceUtils.releaseConnection(connection, ds);
        }

If understanding ur advice correctly, I'll use this and observe the
situation whereafter.
-- 
View this message in context: 
http://n4.nabble.com/Oracle-session-excess-over-maxActive-tp1584311p1588407.html
Sent from the Commons - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to