473,722 Members | 2,468 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

SQL from Java - PREPARE (with parameter markers) vs. Dynamic

m
Maybe this has been asked and answered - but I have been looking through
old archives for quite some time....

Typical Java app running from Websphere connected to DB2 V8.2FP15 on
Linux using JDBC Type 4 drivers. Programmers use mostly PREPARE/EXECUTE
logic for security and 'other' reasons - but some SQL executes MUCH
slower than same SQL using plain old SQL with values then the SQL with
variable markers. Worst case 20 seconds vs. 1 second. Best case 4
seconds vs. .2 seconds. I've read about REOPT(ALLWAYS), etc. but can't
figure out HOW this could be implemented in Java or at the database for
SQL being submitted by these Java apps. Any help would be appreciated.
Mar 18 '08 #1
1 2893
m
m wrote:
Maybe this has been asked and answered - but I have been looking through
old archives for quite some time....

Typical Java app running from Websphere connected to DB2 V8.2FP15 on
Linux using JDBC Type 4 drivers. Programmers use mostly PREPARE/EXECUTE
logic for security and 'other' reasons - but some SQL executes MUCH
slower than same SQL using plain old SQL with values then the SQL with
variable markers. Worst case 20 seconds vs. 1 second. Best case 4
seconds vs. .2 seconds. I've read about REOPT(ALLWAYS), etc. but can't
figure out HOW this could be implemented in Java or at the database for
SQL being submitted by these Java apps. Any help would be appreciated.
Main goal is to let programmers continue to use PREPARE/EXECUTE - but
somehow implement REOPT(ONCE) or REOPT(ALLWAYS) to get the SQL optimizer
to pick an access plan based on actual predicate values. I know REOPT is
a BIND option - so again - how can this be implemented on dynamic SQL
packages?
Mar 18 '08 #2

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

Similar topics

31
2591
by: somebody | last post by:
No, I'm not a troll, just angry. I just started learning C++, and find it extremely lacking compared to Java. For example, I had to write my own functions to do something as simple as a case insensitive string comparison, and a substring search. Then I found that there are no networking classes to speak of (except sockets). After I thought about it, C++ really pales by comparison. Java has a rich set of networking classes, regular...
4
2374
by: Steve Smith | last post by:
I need to add an additional String parameter to a Java SP (DB2 8.1 0 using DB2 Development Center - FP4). Everytime I do this I get the following error message when building:- "G2REPORT.G2REP_INTERMEDIARY_SS" contains an invalidly formatted library/function identification in the EXTERNAL NAME clause. LINE NUMBER=12. SQLSTATE=42878 G2REPORT.G2REP_Intermediary_SS - Build failed. G2REPORT.G2REP_Intermediary_SS - Roll back completed...
1
2054
by: Mike | last post by:
Envirnoment is UDB 7.2 fp9 on AIX. I'm familiar with using "dynexpln" for quickly comparing access plans for directly executable queries. dynexpln docs suggest it cannot work with sql that contains parameter markers. But, when there is no Control-centre (i.e. text only access via korn-shell, no x-windows), how can I use db2 on aix command line programs
0
2688
by: RG | last post by:
OleDbCommand.Prepare error: Size of parameter (VB.NET 2003) I need to do a SQL INSERT statement into an Access table, and I’d like to use the exact technique described in the Help file example for OleDbCommand.Prepare Method. When I follow the example exactly I get the unhandled exception error message: “OleDbCommand.Prepare Method requires all parameters to have an explicitly set type”.
1
2939
by: rAinDeEr | last post by:
Hi, I have started using DB2 UDB ESE v8.2 in Linux recently. I have seen a lot of articles on packages, prepare statement, bind and execute statement. I havent got a clear idea. I have written a few stored procedures but havent used prepare and execute.
2
1862
by: Mahesh S | last post by:
Hi I have created a UDF which sits in db2 database. I want to call that UDF from within a java program and capture the result. The UDF takes a string parameter and returns a double value. This is the code I came up with but it doesnt work and I dont know
18
1930
by: Lance Wynn | last post by:
One of my server has been compromised from this virus, and I can't seem to block it out! I have shut down the infected server, but I need to figure out how to check for this, and stop it. The site is running iis5 on Windows2000, the backend DB is SQLServer 2000 Can anyone point me to some good resources for this? This is urgent! Thanks alot Lance
2
3567
by: PaulR | last post by:
Hi, (DB2 LUW v8.2) When using parameter markers how does the optimizer evaluate filter factors? - and is it able to make use of distribution stats. for parm. markers? The reason I ask, is we have heavily skewed data in places and we need
1
5555
by: Massimiliano Campagnoli | last post by:
Hy, I am trying to understand how the prepare statement works. I am using Qt C++ library to access db2: { .... QSqlQuery cust_query; cust_query.prepare("SELECT CUST_NAME FROM CUSTOMERS WHERE CUST_ID=?");
0
8867
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, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
8740
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9386
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9158
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9090
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8059
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 projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6685
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4503
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
2148
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.