Hi,
When using a CallableStateme nt with the IBM DB2 Universal JDBC Driver
the executeUpdate and getUpdateCount( ) methods on CallableStateme nt
always return -1. According to the JDBC specification it should return
the number of rows affected by the stored procedure and 0 if no rows
are affected (and it does this for all other database's jdbc drivers).
I opened a PMR with IBM and received the following explanation. IBM
claims that stored procedures on DB2 do not return this update value.
The database itself does not return an update value. So, there is no
way to return this value to the JDBC driver, instead of returning an
incorrect value, they have chosen to always return -1.
I am prepared to accept this explanation, but unfortunately it makes
it difficult to write generic cross-database platform code. Is there
any way of detemining the number of rows that a stored procedure
affects(perhpas from the catalog tables) without actually writing
extra code in the SQL Stored Procedure.
Cheers
Otto 7 4198
On Nov 14, 6:45 am, Otto Carl Marte <Otto.Ma...@gma il.comwrote:
Hi,
When using a CallableStateme nt with the IBM DB2 Universal JDBC Driver
the executeUpdate and getUpdateCount( ) methods on CallableStateme nt
always return -1. According to the JDBC specification it should return
the number of rows affected by the stored procedure and 0 if no rows
are affected (and it does this for all other database's jdbc drivers).
I opened a PMR with IBM and received the following explanation. IBM
claims that stored procedures on DB2 do not return this update value.
The database itself does not return an update value. So, there is no
way to return this value to the JDBC driver, instead of returning an
incorrect value, they have chosen to always return -1.
I am prepared to accept this explanation, but unfortunately it makes
it difficult to write generic cross-database platform code. Is there
any way of detemining the number of rows that a stored procedure
affects(perhpas from the catalog tables) without actually writing
extra code in the SQL Stored Procedure.
Cheers
Otto
nope. Any attempt to write cross-database platform code will
collapse as soon as it has to either run fast or address stored
procedures. DBMSes are mutually alien and disjoint in their
needs and implementations surrounding those issues.
HTH,
Joe Weinstein at BEA Systems
"jo*******@bea. com" <jo***********@ gmail.comwrote in message
news:95******** *************** ***********@e10 g2000prf.google groups.com...
On Nov 14, 6:45 am, Otto Carl Marte <Otto.Ma...@gma il.comwrote:
Hi,
When using a CallableStateme nt with the IBM DB2 Universal JDBC Driver
the executeUpdate and getUpdateCount( ) methods on CallableStateme nt
always return -1. According to the JDBC specification it should return
the number of rows affected by the stored procedure and 0 if no rows
are affected (and it does this for all other database's jdbc drivers).
I opened a PMR with IBM and received the following explanation. IBM
claims that stored procedures on DB2 do not return this update value.
The database itself does not return an update value. So, there is no
way to return this value to the JDBC driver, instead of returning an
incorrect value, they have chosen to always return -1.
I am prepared to accept this explanation, but unfortunately it makes
it difficult to write generic cross-database platform code. Is there
any way of detemining the number of rows that a stored procedure
affects(perhpas from the catalog tables) without actually writing
extra code in the SQL Stored Procedure.
Cheers
Otto
I am not sure how JDBC can return the number of rows updated (or
inserted/deleted) in a stored procedure because there are typically (or at
least possible) multiple SQL statements in a Stored Procedure.
Within a DB2 stored procedure, it can be written to capture and return the
number of rows updated for a specific SQL statement, and then return it as
an out parameter (which I do frequently). This can done with GET_DIAGNOSTICS
ROW_COUNT in a SQL Stored Procedure, or examining the ERRD(3) field in the
SQLCA for a SP written in C, etc.
Thanks for this, but I beg to differ on this. Considering we have
successfully written cross-database platform high performance stored
procedures :-)
The one thing it does take is a lot of time and effort. We have
written wrappers that ensure that JDBC drivers do behave similarly.
Within constraints cross-platform database access is possible...
nope. Any attempt to write cross-database platform code will
collapse as soon as it has to either run fast or address stored
procedures. DBMSes are mutually alien and disjoint in their
needs and implementations surrounding those issues.
HTH,
Joe Weinstein at BEA Systems
I am not sure how JDBC can return the number of rows updated (or
inserted/deleted) in a stored procedure because there are typically (or at
least possible) multiple SQL statements in a Stored Procedure.
Sure, we are interested in the last updated/inserted/deleted statement
typically.
Within a DB2 stored procedure, it can be written to capture and return the
number of rows updated for a specific SQL statement, and then return it as
an out parameter (which I do frequently). This can done with GET_DIAGNOSTICS
ROW_COUNT in a SQL Stored Procedure, or examining the ERRD(3) field in the
SQLCA for a SP written in C, etc.
This is what i am trying to avoid, having to explicit code for this on
DB2 in the application code.
Applicaton code writters need to be immune from this (it all happens
magically for them :-) )
I would likes some JDBC wrapping code to determine the number of rows
affected and mimic the
stored proc update count value functionality that is supplied by other
DB vendors.
Otto Carl Marte wrote:
ERRD(3) is what i am after, the rowcount of the last INSERT/DELETE/
UPDATE statement.
The LAST UDI statement of the procedure only? I'd have guessed that it shoudl contain the SUM of all UDI statement rowcounts. Can you clarify?
The LAST UDI statement rowcount for the procedure is returned. Not the
sum.
That doesn't make much sense to me. Why the last and not the first? Or the
3rd?
--
Knut Stolze
DB2 z/OS Utilities Development
IBM Germany
On Nov 27, 8:16 am, Knut Stolze <sto...@de.ibm. comwrote:
Otto Carl Marte wrote:
ERRD(3) is what i am after, the rowcount of the last INSERT/DELETE/
UPDATE statement.
The LAST UDI statement of the procedure only?
I'd have guessed that it shoudl contain the SUM of all UDI statement
rowcounts. Can you clarify?
The LAST UDI statement rowcount for the procedure is returned. Not the
sum.
That doesn't make much sense to me. Why the last and not the first? Or the
3rd?
--
Knut Stolze
DB2 z/OS Utilities Development
IBM Germany
Yeah, it isn't very convincing, but its the truth :-)
Otto Carl Marte wrote:
On Nov 27, 8:16 am, Knut Stolze <sto...@de.ibm. comwrote:
>Otto Carl Marte wrote:
ERRD(3) is what i am after, the rowcount of the last INSERT/DELETE/
UPDATE statement.
>The LAST UDI statement of the procedure only? I'd have guessed that it shoudl contain the SUM of all UDI statement rowcounts. Can you clarify?
The LAST UDI statement rowcount for the procedure is returned. Not the
sum.
That doesn't make much sense to me. Why the last and not the first? Or the 3rd?
Yeah, it isn't very convincing, but its the truth :-)
....which doesn't make it any better. So why use such a crappy "feature" in
the first place?
--
Knut Stolze
DB2 z/OS Utilities Development
IBM Germany This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Axel Dachtler |
last post by:
Hello,
my Java-program can't load the JDBC driver.
I always get a java.lang.NoClassDefFoundError when I run it.
The JDBC Driver is in the directory: C:\programs\ora92\jdbc\lib
I think I have to set ORACLE_HOME environment variable and CLASSPATH,
but I have no idea how ?????????
|
by: sridhar nagabhurshana |
last post by:
hello
I am trying to connect to mysql database using connector/J jdbc driver
this is my code
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
|
by: Ajay |
last post by:
Hi,
Could some please tell me whether Microsoft provides Type 2 and Type 4
jdbc driver ? For Type 4 MS provides
com.microsoft.jdbc.sqlserver.SQLServerDriver driver. What is the
cofiguration required for type 2 driver and what driver class files
required ?
Its very urgent to me please reply.
Ajay
|
by: Dani |
last post by:
Hi everyone
Description of the problem:
Using a PreparedStatement to write down an integer (int) plus a
timestamp for testing purposes. When read out again the integer looks
very different. We found that it was shifted three Bytes to the left,
i.e. 4 becomes hex 4000000 which is 67108864 in decimal base. This
means that the value written and the value read sometimes do not
match, which is of course inacceptable for all real world...
|
by: Bing |
last post by:
Hi,
I am configuring the same DB2 v8.1 JDBC universal driver (db2jcc.jar
and db2jcc_license_cisuz.jar) from DB2 SP5 fix pack under WSAD 5.1.x
environment and WebSphere application Server 5.0.2 on Windows 2000
machines. I configured a connection pool data source using type 4 for
a local test environment in WSAD 5.1.x, and a connection pool data
source on the WebSphere Server too. Both data sources are accessing
the same database.
| |
by: Raquel |
last post by:
Read this about the Universal JDBC Driver....
"In a Type 2 mode, the Universal JDBC driver provides local
application performance gains (because it avoids using TCP/IP protocol
to communicate to the DB2 server). "
Wht does it mean by "local" application performance? In type 2 mode,
it is a pre-requisite that all the databases that the application
running at the client need to be cataloged (through CCA or otherwise)
on the client; Most...
|
by: Kris Jurka |
last post by:
The JDBC driver has been moved out of the main source tree to a gborg
project. This change will only affect new major releases. The 7.4 series
will continue to be maintained in the main tree. The impact on the
average user depends on how you got your .jar file.
If you downloaded a binary version from http://jdbc.postgresql.org/
then you will see no change. This website will remain the official place
for distributing the driver and...
|
by: frank |
last post by:
I have installed DB2 V7.2 twice now and I keep getting the error:
" CLI0622E Error accessing JDBC administration
service extensions."
I see that this is a fairly common error but I have yet to find out how
to modify the "CLASSPATH" per some of the replies. Please direct me to
the path and file I need to modify to fix this problem.
Thanks much!
|
by: rpm45tech |
last post by:
Hi everyone. I'm deveolping in Java with DB2 running on Win XP and everything was working ok but then I installed Vista Ultimate and the application stopped working. This is the exception showed:
org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class 'COM.ibm.db2.jdbc.app.DB2Driver' for connect URL...
|
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 usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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,...
| |
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...
|
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,...
|
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...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |