commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Carman <ja...@carmanconsulting.com>
Subject Re: [dbcp] Re: Oracle session excess over maxActive
Date Thu, 11 Mar 2010 21:26:06 GMT
I was thinking more along the lines of using JdbcTemplate, which means
you don't manage the connections (or statements or result sets)
yourself.  You let Spring do that.

On Thu, Mar 11, 2010 at 1:33 PM,  <cyrille.roy@free.fr> wrote:
> looks good.
> Don't forget the rollback in the catch and it should work.
>
> Cyrille
>
> ----- Mail Original -----
> De: "sic" <sic_1234@naver.com>
> À: user@commons.apache.org
> 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: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message