Idea behind a prepared statement is that you basically execute the same SQL over and over, just varying a paramter or 2. e.g.:
SELECT PRODUCTNAME FROM PRODUCTS WHERE PRODUCTID = ? With a prepared statement, the RDBMS parses and pre-compiles a statement like this only once and hangs onto it, rather than having to do that each time you do a query. Then you can later "fill in the blank" on a pre-compiled prepared statement (e.g. substitute product id #1234) and then execute it. Bottom line is that it's a more efficient approach than just using straight SQL. DR At 01:37 PM 5/10/2002 -0700, you wrote: >What would be the advantage of using a PreparedStatement rather than >a Statement if I'm using connection pooling? > >I know that the PreparedStatement is precompiled but in my >environment, I typically get a connection from the pool, execute my >query, process my results, and then free the connection all in one >method. So, if I were using a PreparedStatement, wouldn't the query >in the PreparedStatement need to be compiled every time the method is >called anyway? To change your membership options, refer to: http://www.sys-con.com/java/list.cfm
