//Say you have something like this

Statement       statement=con.createStatement ();

for (n=1;n<=10;n++) {
    statement.executeQuery("select * from -.....");
}

//your query "select * from ...."  is  compiled 10 times and executed  10 times.

//Using a prepare statement:

PreparedStatement  preparedStatement=con.prepareStatement("select * from ....");

for (n=1;n<=10;n++) {
    preparedStatement.executeQuery();
}

//your query "select * from ...."  is  compiled one time  and executed 10 times.

//You don´t have  to make your code synchronized just for using
prepareStatements.


Demch. :)

A Suresh wrote:

> hi all, Jason Hunter says "a PreparedStatement is precompiled by the
> databasefor faster execution". What exactly does this mean? Where does the
> statementreside during servlet execution? Code accessing a PreparedStatement
> needsto be synchronized for multiple users? Can anyone
> elaborate? thanks,______________________________________________
> A Suresh
> [EMAIL PROTECTED]
> + 91 - 040 - 7896008 ( Ext. 4611 )

--
**********************************************************
     Ing. Diego Malpica Chauvet 238-5083 ext 5083
       Departamento de Sistemas de Infomación

                    Tec de Monterrey
1999: Año de la Confianza en el Campus Estado de México
           Premio Nacional de Calidad 1998
**********************************************************

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to