(snips throughout)

>     Connection con=getconnection();//get the connection from pool

the pool being a javax.sql.DataSource right?

> 1.whether there is any benefit in using prepared statement in such a case or
> a simple statement will do?

using PreparedStatements gives the database an opportunity to compile and optimize 
frequently executed queries.  If you use pure
statements, the database doesn't get this opportunity.

> 2.whether the app server caches the prepared statement also along with the
> connection so that the same statement is sent to the database. I read an
> article
> titled "Why Prepared Statements are important and how to use them properly"
> in serverside.com and it says the server does cache them.. but are they
> server dependent or does the spec says that it is mandatory

optional

> 3. But the sample chapter "Performance" from the book Java Programming with
> Oracle JDBC posted in  O'Reilly site advices to use statements instead of
> prepared statements..

for those after the url: 
http://www.onjava.com/pub/a/onjava/excerpt/oraclejdbc_19/index.html

quote:

"it takes about 65 iterations of a prepared statement before its total time for 
execution catches up"

I haven't taken the time to read the whole article... but I cant think of a server 
side application that wouldn't call a prepared
statment 65 times or more....

I always use prepared statements.

cheers
dim




>
> what path should i follow??
>
> thanx in advance,
> mani
>
>
>
>
>
>
>
>
>
> }
>
> ===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff EJB-INTEREST".  For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".
>
>

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to