473,545 Members | 2,705 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Query in Prepared statements caching

Hii ,
I am using Db2 V 7.1 on ZOS
I have the following Java Code
query.append("i nsert into ");
query.append(sc hemaName+".EMAI L_DATA ");
query.append("( EMAIL_NBR, DT_FIRST_SENT,S UBJECT
,EMAIL_ADDR,EMA IL_DTL,ER_NBR, DT_CREATED,DT_L AST_SENT)
values(?,?,?,?, ?,?,?,?) ");
prepStmt=connec t.prepareStatem ent(query.toStr ing());

I want to know whether the above query would be cached in the data
base server since apart from the using the standard ? to give various
parameters at runtime , I am also picking up the schema at runtime and
not hardcoding.
But obviously the schema name will remain the same for all the calls
to the DB.
I donno whether due to the usage of a Java Variable in the query at
runtime whether this will be cached or not ?
Can some one please throw some light on it ?
Regarda,
-Neeraj
Nov 12 '05 #1
2 3633

"Neeraj" <ma*********@ya hoo.co.in> wrote in message
news:74******** *************** ***@posting.goo gle.com...
Hii ,
I am using Db2 V 7.1 on ZOS
I have the following Java Code
query.append("i nsert into ");
query.append(sc hemaName+".EMAI L_DATA ");
query.append("( EMAIL_NBR, DT_FIRST_SENT,S UBJECT
,EMAIL_ADDR,EMA IL_DTL,ER_NBR, DT_CREATED,DT_L AST_SENT)
values(?,?,?,?, ?,?,?,?) ");
prepStmt=connec t.prepareStatem ent(query.toStr ing());

I want to know whether the above query would be cached in the data
base server since apart from the using the standard ? to give various
parameters at runtime , I am also picking up the schema at runtime and
not hardcoding.
But obviously the schema name will remain the same for all the calls
to the DB.
I donno whether due to the usage of a Java Variable in the query at
runtime whether this will be cached or not ?
Can some one please throw some light on it ?


From DB2's perspective, the exact statement (query string) given to
prepareStatemen t() will be cached.
DB2 doesn't know that the statement is built up of some string values and
the "dynamicall y" determined schema name.
Thus, if you run this multiple times without changing the schema, DB2 will
always reuse the cached version.

--
Matt Emmerton
Nov 12 '05 #2
ma*********@yah oo.co.in (Neeraj) wrote in message news:<74******* *************** ****@posting.go ogle.com>...
Hii ,
I am using Db2 V 7.1 on ZOS
I have the following Java Code
query.append("i nsert into ");
query.append(sc hemaName+".EMAI L_DATA ");
query.append("( EMAIL_NBR, DT_FIRST_SENT,S UBJECT
,EMAIL_ADDR,EMA IL_DTL,ER_NBR, DT_CREATED,DT_L AST_SENT)
values(?,?,?,?, ?,?,?,?) ");
prepStmt=connec t.prepareStatem ent(query.toStr ing());

I want to know whether the above query would be cached in the data
base server since apart from the using the standard ? to give various
parameters at runtime , I am also picking up the schema at runtime and
not hardcoding.
But obviously the schema name will remain the same for all the calls
to the DB.
I donno whether due to the usage of a Java Variable in the query at
runtime whether this will be cached or not ?
Can some one please throw some light on it ?
Regarda,
-Neeraj


DB2 has package cache will do this job for y.
Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2259
by: Mark | last post by:
hello! mysqli in PHP5 comes with prepared statements functionality. However, without persistent connections or connection pooling in this code library, one has to ask: why bother? are prepared statements 'remembered' by the server for a while between connections, so that new connections can take advantage of them, or are they really...
1
3799
by: Tom D | last post by:
I'm rewriting a database interface that our company currently has. Currently it's using the Pear::DB interface, but we found that that was introducing a bit too much overhead. I'm rewriting the interface to use mysqli. Most of what the interface does is to simplify getting results in the form of arrays (ordered and associative). Most of the...
9
2187
by: Wescotte | last post by:
Here is a small sample program I wrote in PHP to help illustrates problem I'm having. The data base is using DB2 V5R3M0. The client is WinXP machine using the iSeries Client Access Driver ver 10.00.04.00 to connect to the database. The problem is that executing the exact same SQL select statement more than twice int a row stops produces...
5
1267
by: Darin L. Miller | last post by:
I'm not too good with advanced SQL queries, so please bear with me on this. I have a query with multiple joins that I am trying to get just the last 10 of each unique record (RecordID) displayed. The problem is that some records have more than one photo assigned to the same RecordID and I only need one of them displayed for the results...
0
4210
by: masri999 | last post by:
When I executed DBCC Memory Status following are the out put Buffer Distribution Stolen 187191 Free 1026 Procedures 6698 Inram 0 Dirty 154661 Kept 0 I/O 0
4
2971
by: Hermann | last post by:
My site is a bit slow showing the main page so I thought caching query result in PHP will improve performace. Then I read MySQL documentation and saw that MySQL does have a caching feature. So... now I dont know if doing the PHP caching is worth the pain. Would there be any noticed performace improvement if I cache query results in PHP,...
17
2713
by: NeoAlchemy | last post by:
I am starting to find more web pages that are using a query parameters after the JavaScript file. Example can be found at www.opensourcefood.com. Within the source you'll see: <script src="/shared/scripts/common.js?revision=1.6" type="text/javascript">. I am trying to see if there is any big deal to this or a best practice that is...
2
3370
by: Pugi! | last post by:
It is by accident that I noticed that I forgot to use mysql_real_escape_string in part of my webapp. I tested input with following text : Hélène 51°56'12'' http://www.mysite.org/folder 3 functions worked correctly and 1 failed: The one that failed didn't have mysql_real_escape_string and neither did 2 of the ones that worked: in those 2 I...
1
2020
by: lazukars | last post by:
I have done a good amount of research on prepared statements in php. The problem is that I have found various examples on how to select and insert information into a Mysql database. I want to make sure that I am doing this correctly. Could anyone please show post a correct example of how to SELECT data from mysql via prepared statements via...
0
7499
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7689
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7943
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
6022
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5359
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3470
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1919
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1044
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
743
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.