Re: ResultSet processing/closure in JSP

From: Joe Weinstein (joeNOSPAM_at_bea.com)
Date: 01/12/05

  • Next message: shravan P G via JavaKB.com: "cannot load jdbc driver."
    Date: Tue, 11 Jan 2005 17:42:55 -0800
    To: Simon <simon.lambert@gmail.com>
    
    

    Simon wrote:
    > Hi,
    >
    > I am trying to understand the implications of processing a ResultSet
    > in a JSP given that the ResultSet is created in a servlet, and then
    > placed in the request to provide access to the JSP.
    >
    > My confusion is how the closure of the ResultSet is managed. I am
    > aware that the standard procedure would be to open a connection,
    > execute a statement, and then process the results, before closing the
    > connection, statement, and result set in the servlet code. As the
    > ResultSet object is required by the JSP where should I handle closing
    > it? It seems very messy to create the ResultSet in the servlet, and
    > then close it in the JSP.
    >
    > Any thoughts/suggestions are much appreciated.
    >
    > Thanks,
    > Simon

    Hi. You should ideally close result sets asap, then close statements asap,
    and lastly but most importantly, you should close connections without fail,
    asap. By JDBC spec though, re-executing or closing the statement will
    automatically close any outstandling result set from the statement, and
    closing any connection will automatically close any outstanding statement
    it produced, so that cascades all the way down.
    Joe Weinstein at BEA


  • Next message: shravan P G via JavaKB.com: "cannot load jdbc driver."

    Relevant Pages

    • Re: ResultSet processing/closure in JSP
      ... > I am trying to understand the implications of processing a ResultSet ... > placed in the request to provide access to the JSP. ... > connection, statement, and result set in the servlet code. ...
      (comp.lang.java.programmer)
    • Re: ResultSet processing/closure in JSP
      ... now from my jsp i call the open method using an object of same class do th ... > I am trying to understand the implications of processing a ResultSet ... > aware that the standard procedure would be to open a connection, ... > connection, statement, and result set in the servlet code. ...
      (comp.lang.java.databases)
    • Re: ResultSet processing/closure in JSP
      ... > I am trying to understand the implications of processing a ResultSet ... > placed in the request to provide access to the JSP. ... > execute a statement, and then process the results, before closing the ... > connection, statement, and result set in the servlet code. ...
      (comp.lang.java.programmer)
    • ResultSet processing/closure in JSP
      ... I am trying to understand the implications of processing a ResultSet ... placed in the request to provide access to the JSP. ... connection, statement, and result set in the servlet code. ... ResultSet object is required by the JSP where should I handle closing ...
      (comp.lang.java.databases)
    • ResultSet processing/closure in JSP
      ... I am trying to understand the implications of processing a ResultSet ... placed in the request to provide access to the JSP. ... connection, statement, and result set in the servlet code. ... ResultSet object is required by the JSP where should I handle closing ...
      (comp.lang.java.programmer)