This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Is PreparedStatement cached in WebSphere?

 
Edy Yu
Ranch Hand
Posts: 264
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As the subject ...
Thanks in advance ...
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes they are. Open the WebSphere InfoCenter and do a search for "Prepared Statement Cache".
Kyle
 
Edy Yu
Ranch Hand
Posts: 264
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 264
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic