PreparedStatement is a way to dynamically create access path for determining
the most efficient and quickest way to fetch data from the database and it
is controlled by the database.
It will be under context of the connection that was created to the database.
In case the connection was closed and re-created and if the same statement
was prepared again the database will go to its cache to check whether the
access paths are in there. If true it will reuse it or else it will create a
new access path.


____________________
Glenn J. Pinto
BB&T
IS-Alternative Delivery Systems
* mailto:[EMAIL PROTECTED]
* (919) 716-9305
* (919) 565-1177
* 172-85-01-00

> -----Original Message-----
> From: Jason Kilgrow [SMTP:[EMAIL PROTECTED]]
> Sent: Thursday, July 25, 2002 4:54 PM
> To:   JDJList
> Subject:      [jdjlist] Re: PreparedStatement
> 
> Whether or not the connection is closed is irrelevant. Once you
> free/release the connection back to the pool, you have to get another
> one. However, I think that your pstmt object will still be usable. If
> not, make another one just like your previous one (same parameters,
> etc.) and you should get the same effect (increased performance for
> numerous hits).
> > 
> > > hi all!
> > > is there anyone who can quickly answer the following question for
> > me
> > > (otherwise I will have to dig into JDBC implementation
> > details...)
> > > in one of my servlets I would like to keep PreparedStatement
> > objects over
> > > numerous calls to the same pages and just update the parameters
> > every time.
> > > e.g.
> > >   Connection con = ... //obtain connection, perhaps from
> > connection pool
> > >   PreparedStatement pstmt = con.prepareStatement("SELECT * FROM
> > any WHERE
> > > some=?");
> > > I keep the reference pstmt (e.g. inside the session object) for
> > later use.
> > > the connection, on the other hand, is released again (because it
> > came from a
> > > connection pool or the like, not closed!)
> > > now my question is:
> > > when I call something like
> > >   pstmt.setInt(1,10);
> > >   ResultSet rs = pstmt.executeQuery();
> > > later, is it of any relevance if the connection-object that was
> > used for the
> > > creation of the PreparedStatement is back in the pool, or even
> > used by
> > > someone else in the meantime?
> > > thanx & greetings to all
> > >
> > > --
> > > GMX - Die Kommunikationsplattform im Internet.
> > > http://www.gmx.net
> > >
> > > To change your membership options, refer to:
> > > http://www.sys-con.com/java/list.cfm
> > 
> > 
> > To change your membership options, refer to:
> > http://www.sys-con.com/java/list.cfm
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Health - Feel better, live better
> http://health.yahoo.com
> 
> To change your membership options, refer to:
> http://www.sys-con.com/java/list.cfm

To change your membership options, refer to:
http://www.sys-con.com/java/list.cfm

Reply via email to