> but how its working ?
I'm tempted to say, "It works very well". Databases
are very good abstractions, and the vast majority
of time, a basic understanding of relational algebra
and SQL is all you need to deal with them successfully.
But you've got a good question below:
> do you mean, when we run the java code ....the SQL query go to the DB
> ...then DB makes a query plan for it via its DB compiler and keep
> remeber this query plan permanently as it has come from a
> preparedstatement .......so next times , the DB dont make any new query
> plan .
That's right.
> But see , they are telling "precompiled" ...still , i dont know what it
> means ? and also how DB will know whther the query is coming from a
> preparedstatement or simple statement .....DB is seperate layer.
That's also right: the database is quite separate from the
JVM.
The key here is JDBC. JDBC is not something that lives
entirely in the Java world, it knows about the internals
of the database you're connecting to, and knows exactly
how to tell the database what kind of statement it's
dealing with. That's why you need a new JDBC implementation
every time you switch databases.
(For instance, I have in one current project's lib directory
jconn3.jar and postgresql-8.0-313.jdbc3.jar; one's for a Sybase
database, and the other's for Postgres. Both implement the same
JDBC.)
Just how much work can be done in advance ("precompilation")
probably varies wildly with what type of database you're
connecting to. That's okay; while you're writing client code,
it just doesn't matter.

Signature
Mark Jeffcoat
Austin, TX
gk - 22 Nov 2006 00:35 GMT
> > but how its working ?
>
[quoted text clipped - 40 lines]
> Mark Jeffcoat
> Austin, TX
yea, thats what i wanted know . nice explanation.