Hey!

I don't know what you mean by connection in the pool, but here's how I
do it.

  try {

   // Create an instance of the JDBC driver so that it has
   // a chance to register itself

   // Create a new database connection.

   // Create a statement object

   // Execute the query

   // Run through the result set
  }
  catch (YourException y) {    //Your Exception class
   // Send the error back to the client
  }
  catch (Exception ex) {     //java's
   // Send the error back to the client
  }
  finally {
   try {
    // Always close properly
    if (resultset != null) {    //The Resultset
     resultset.close();
    }
    if (statement != null) {    // The Statement
     statement.close();
    }
    if (con != null) {          // The Connection
     con.close();
    }
   }
   catch (Exception ex) {
   // Ignore any errors here
   }
  }//end of finally

The reason that I add the 'finally' is if your app throws an exception
and something goes
wrong while trying to handle it, you still will be able to close.

I hope this helps.

Oh.  BTW Please shut off your HTML when requesting help from this
E-list.  Just use text-only.

Sans adieu,
Danny Rubis





arijith wrote:

>  Hi , Does anyone know the sequence in which a resultset, statement
> and the connection has to be closed to ensure proper freeing of the
> connection in the pool?I am using Netscape App Server 4.0 . Is there
> any specification in JDBC over the order in which these should be
> closed ? Thanks,arijith

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to