Thanks Kyle. I have WSAD 5.1.0 and my test app is running on the WebSphere 5.0 Test Environment in it. With the same PreparedStatement SQL string, everytime I call Connection.prepareStatment(sql string), I get a new PreparedStatement object. This made me wondering ...
Joined: Aug 10, 2001
The caching occurs underneath the covers. If you count the PREPAREs that are actually being done by the database you'd find it's exactly once per unique String. Kyle
Joined: Nov 21, 2000
Thanks Kyle. One question, how to count the PREPAREs in the database? Here is the dilemma that still bothers me. My uderstanding of the prepared statement caching is as following: Let the WebSphere App Server be the client for this JDBC connection, let the database server be the server. The client will cache the prepared statement, while the server will cache the prepared statement at its side also. So, there are two caches involved. One in WebSphere, one in the database. I have not much doubt that the database server will cache the prepared statement. But based on test, I am still not fully convienced that WebSphere is doing the same thing. Or maybe it is, it just generates different PreparedStatement object references even the same sql string is used. But underneath, the WebSphere server is caching it??? For the same test, I used Oracle 9i JDBC driver and turned implicit caching on. With the same sql string, I get the same PreparedStatement (same object references) all the time. Maybe I drill this topic too deep. But I just want to find out the details on how the concept that I always take for granted is implemented. Thanks in advance.