hi,

  i am using stateless session beans+jdbc for retrieving the data from the
database. The data is spread across different tables and i am making a query
with complex joins.

this is the code format

ejb method(){

    Connection con=getconnection();//get the connection from pool
    PreparedStatement ps=con.preparestatement(query);
    ps.setObject(param);//set the parameters
     ResultSet rs = ps.executeQuery();
//get all the data from result set
....
....

 rs.close();
     ps.close();
     con.close();

}

This method is called very frequently by other beans.

my doubt  is
1.whether there is any benefit in using prepared statement in such a case or
a simple statement will do?
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
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..

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".

Reply via email to