wood burning stoves*
The moose likes Websphere and the fly likes Is PreparedStatement cached in WebSphere? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Websphere
Bookmark "Is PreparedStatement cached in WebSphere?" Watch "Is PreparedStatement cached in WebSphere?" New topic
Author

Is PreparedStatement cached in WebSphere?

Edy Yu
Ranch Hand

Joined: Nov 21, 2000
Posts: 264
As the subject ...
Thanks in advance ...


<i><br />Sun Certified Programmer for Java 2 Platform (SCJP)<br />Sun Certified Developer for Java 2 Platform (SCJD)<br />Sun Certified Web Component Developer for Java2 Platform, Enterprise Edition (SCWCD)<br />Sun Certified Business Component Developer for Java2 Platform, Enterprise Edition (SCBCD)<br />Sun Certified Enterprise Architect for J2EE (SCEA)<br />IBM Certified Enterprise Developer, WebSphere Studio V5.0<br /></i>
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
Yes they are. Open the WebSphere InfoCenter and do a search for "Prepared Statement Cache".
Kyle


Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at http://www.kyle-brown.com/ for other WebSphere information.
Edy Yu
Ranch Hand

Joined: Nov 21, 2000
Posts: 264
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 ...
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
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
Edy Yu
Ranch Hand

Joined: Nov 21, 2000
Posts: 264
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Is PreparedStatement cached in WebSphere?