While using conn.close() does it return the connection to the pool??
Its not a driver connection rather a data source connection...so waht happens when i 
do conn.close()?
does it go back to the pool?

        -----Original Message----- 
        From: Geeta Ramani [mailto:[EMAIL PROTECTED] 
        Sent: Tue 4/6/2004 10:20 PM 
        To: Struts Users Mailing List 
        Cc: 
        Subject: Re: Connection Pooling (How i use...)
        
        

        This your problem: closing the connection in your try block. Move it to a 
finally block..
        
        Marcelo Epstein wrote:
        
        > I use the pool like this: (IS IT WRONG??) I think the connection is being 
closed..
        >
        > try {
        >         Context ctx = new InitialContext();
        >         if (ctx == null)
        >               throw new Exception("Boom - No Context");
        >
        >               DataSource ds = (DataSource) 
ctx.lookup("java:comp/env/jdbc/EasyDB");
        >
        >               if (ds != null) {
        >                 Connection conn = ds.getConnection();
        >                 if (conn != null) {
        >                         Statement stmt = conn.createStatement();
        >                         String query ="Any query";
        >                         ResultSet rs = stmt.executeQuery(query);
        >                         while (rs.next()) {
        >                                                               "Use ResulSet"
        >
        >                         }
        >                                 stmt.close();
        >                         conn.close();
        >                 }
        >             }
        >         } catch (Exception ex) {
        >                 System.out.println(ex.toString());
        >         }
        >
        > On Tue, 06 Apr 2004 10:19:15 -0600, "Larry Meadors" <[EMAIL PROTECTED]> 
escreveu:
        >
        > > De: "Larry Meadors" <[EMAIL PROTECTED]>
        > > Data: Tue, 06 Apr 2004 10:19:15 -0600
        > > Para: <[EMAIL PROTECTED]>
        > > Assunto: Re: Connection Pooling
        > >
        > > My bet is on a connection leak - you open one in a try block and don't 
close it in the finally block.
        > >
        > > >>> [EMAIL PROTECTED] 04/06/04 10:08 AM >>>
        > > Hi,
        > >
        > > I have just started using Connection Pooling in my app  (Tomcat, Struts, 
DBCP, Mysql) .
        > > It woks for about 20 hours and stop working until tomcat restart.
        > >
        > > I get this exception:
        > >
        > > org.apache.commons.dbcp.SQLNestedException: Cannot get a connection, pool 
exhausted, cause:
        > > java.util.NoSuchElementException: Timeout waiting for idle object
        > >
        > > I canà t fix it. Any advice??
        > >
        > > Thanks in advance.
        > > Marcelo
        > >
        > >
        > >
        > > ---------------------------------------------------------------------
        > > 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]
        > >
        > >
        > >
        > >
        >
        > ---------------------------------------------------------------------
        > 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]
        
        



DISCLAIMER:
This message contains privileged and confidential information and is intended only for 
the individual named.If you are not the intended recipient you should not 
disseminate,distribute,store,print, copy or deliver this message.Please notify the 
sender immediately by e-mail if you have received this e-mail by mistake and delete 
this e-mail from your system.E-mail transmission cannot be guaranteed to be secure or 
error-free as information could be intercepted,corrupted,lost,destroyed,arrive late or 
incomplete or contain viruses.The sender therefore does not accept liability for any 
errors or omissions in the contents of this message which arise as a result of e-mail 
transmission. If verification is required please request a hard-copy version.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to