• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Is PreparedStatement cached in WebSphere?

 
Ranch Hand
Posts: 264
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As the subject ...
Thanks in advance ...
 
author
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
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!