I don't think this is the bug, maybe the bug is that the
drivermanagerconnection pool sometimes runs out of connections and returns a
already closed connection. This will cause an exception in the first try
statement, and an exception in the finally clause before conn.close() is
called.

So in my experience it is my fault that I didn't do the check

if (!conn.isClosed()) { yadayada}

before trying to execute any db related code.

Now, that is the cause of my problem. I still would like the
drivermanagerconnection pool to tell me where this happened so I could debug
it more efficiently.

So for all those who used the way I mentioned a couple of months ago with
below syntax, should really change it unless the have unlimited connections
configured...


/*******include old code ******/

try {
     conn = getConn();
    stmt = conn.prepareStatement();
    rs = stmt.executeQuery();
}catch (SQLException sqle) {

}finally {
    try {
        rs.close();
        stmt.close();
        conn.close();
    }catch (SQLException sqle) {
    }
}

/**********end include *********/



/*******include better code ******/

try {
    conn = getConn();
    stmt = conn.prepareStatement();   /*can generate sqlexception (conn
already closed )*/
    rs = stmt.executeQuery();
    rs.close();
    stmt.close();

}catch (SQLException sqle) {

}finally {
    try {
        conn.close();                            /*closing conn so we don't
get ugly errormessage*/
    }catch (SQLException sqle) {
    }
}

/**********end include *********/



----- Original Message -----
From: "Daniel G. Koulomzin" <[EMAIL PROTECTED]>
To: "Orion-Interest" <[EMAIL PROTECTED]>
Sent: Friday, January 12, 2001 10:06 PM
Subject: Re: DriverManagerConnectionPoolConnection not closed...


> I believe that this is a bug in Orion.
>
> -Dan
>
>
> Johan Fredriksson wrote:
>
> > Is there a way to debug the DriverManagerConnectionPoolConnection so I
> > can detect where it happens? I know that a few places where I used the
> > try {     conn = getConn();    stmt = conn.prepareStatement();    rs =
> > stmt.executeQuery();}catch (SQLException sqle) { }finally {    try
> > {        rs.close();        stmt.close();        conn.close();
> > }catch (SQLException sqle) {    }} one of the close() are throwing an
> > exception and therefore the conn is not closed.  I'd like to have
> > DriverManagerConnectionPoolConnection to tell me where I did this
> > dreadful  mistake. regards   Johan Fredriksson
>
> --
> Daniel G. Koulomzin
> Digital Media On Demand
> 244 Brighton Ave. 3rd Floor
> Allston MA 02134
>
>
>


Reply via email to