Re: Prepared Statement
- From: "Bjorn Abelli" <bjorn_abelli@xxxxxxxxxxxxxxxxxxxxx>
- Date: 7 Jun 2006 10:57:20 +0200
"lakshmi Ashok" wrote...
A query plan is generated each time a query needs to be executed.
What we do with a prepared stmt is to prevent generation of this
query plan each time.
Not necessarily. It *can* be used in that way, but it's really up to the
implementor.
Not all databases makes those query plans...
A pointer to a result set will not exist if you close the
connection itself. Hence, the actual result set could be
somewhere on the DB cache and the interface Result set
could be just a pointer to that memory
And that's how many drivers have it implemented, but it's not a guarantee.
Not all databases uses that kind of cursors, and even if they do, it's not a
guarantee that the driver will make use of it...
Some drivers have more thorogh documentation on what to expect from the
drivers, with possibly even more functionality built in, as the interfaces
only tells us the "minimum" requirements of the implementations.
E.g. if you use OraclePreparedStatements, there are additional getXxx and
setXxx methods to deal with the Oracle specific types.
In some drivers the implementation of Statement have even overridden the
toString method in order to get a "readable" representation of the statement
made, but this is not a requirement, so in many cases they have simply used
the inherited method from Object.
.... this is a part I am also little bit confused about
To add to that confusion...
The interfaces ResultSet, Statement, etc, are just that, interfaces, which
are implemented by classes within the JDBC driver.
Some may make use of specific database functionality and simply "forward"
requests from Java, others may have it built into the driver itself, e.g. to
hold a collection of the results in the memory, etc...
The implementations of the interfaces varies very much, mostly depending on
which database they target.
The only thing the interfaces really guarantee, is that there will be some
sort of implementation for each method in the implementing classes, nothing
more...
/// Bjorn A
Inviato da X-Privat.Org - Registrazione gratuita http://www.x-privat.org/join.php
.
- Follow-Ups:
- Re: Prepared Statement
- From: lakshmi Ashok
- Re: Prepared Statement
- References:
- Prepared Statement
- From: lsrinu
- Re: Prepared Statement
- From: lakshmi Ashok
- Prepared Statement
- Prev by Date: Re: Java SQL interface
- Next by Date: Re: Java SQL interface
- Previous by thread: Re: Prepared Statement
- Next by thread: Re: Prepared Statement
- Index(es):
Relevant Pages
|