473,608 Members | 2,127 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using JDBC batch

Hi,

(V8.1 Fp2)
Our application uses JDBC batch to execute mutiple insert statements
and we saw a strange thing this morning.

There were 4 SQL Insert statements in the batch, and we know the 2nd
would have
violated a Unique Constraint and failed, but the SQL error returned
was related to the 3rd statement (which had a FK dependent on the 2nd
statement).

This has raised some fundamental questions about DB2 JDBC Dtriver
batch processing.

1. Is it possible the 3rd statement was executed before the 2nd
statement?
2. Do we 'Have' to include BEGIN ATOMIC in the batch statements ?
3. Is there some other explanation why we saw the 3rd statement error
returned
and not the 2nd statement?

Any insight/pointers on this or more generally using JDBC batch
greatly
appreciated.

Paul.
Nov 12 '05 #1
2 6556
Hi,
I am reposting this as we have just witnessed it again, and I just
want
to check if anyone believes this is working as designed/configurable
before I open a formal PMR with IBM.

Thanks.

Paul.

pa**@abacus.co. uk (Paul Reddin) wrote in message news:<1f******* *************** ****@posting.go ogle.com>...
Hi,

(V8.1 Fp2)
Our application uses JDBC batch to execute mutiple insert statements
and we saw a strange thing this morning.

There were 4 SQL Insert statements in the batch, and we know the 2nd
would have
violated a Unique Constraint and failed, but the SQL error returned
was related to the 3rd statement (which had a FK dependent on the 2nd
statement).

This has raised some fundamental questions about DB2 JDBC Driver
batch processing.

1. Is it possible the 3rd statement was executed before the 2nd
statement?
2. Do we 'Have' to include BEGIN ATOMIC in the batch statements ?
3. Is there some other explanation why we saw the 3rd statement error
returned
and not the 2nd statement?

Any insight/pointers on this or more generally using JDBC batch
greatly
appreciated.

Paul.

Nov 12 '05 #2
I don't have the answer but i think it would help to know the
driver used? (db2java, db2jcc)
type-2/3, universal/jcc type 4, ...
(to be sure it's supported)

Also verify how the error handling is coded.
What is used in the program.
You trap any BatchUpdateExce ption() ? (SQLException)

Handling an SQLException under the DB2 Universal JDBC Driver
http://www-3.ibm.com/software/data/d...d/cjvjcerr.htm

Behavioral Differences Between the Legacy JDBC Drivers and the Universal
JDBC Drivers
http://publib.boulder.ibm.com/infoce...d/c0010280.htm
see PreparedStateme nt.executeBatch , Compound SQL, etc.

Batched Update Considerations When Using the Universal JDBC Driver
http://publib.boulder.ibm.com/infoce...d/c0010280.htm
snip. universal JDBC driver always batches nonatomically

Online doc link :
http://java.sun.com/j2se/1.3/docs/api/
http://java.sun.com/j2se/1.4.1/docs/api/
see java.sql

public class BatchUpdateExce ption
extends SQLException
An exception thrown when an error occurs during a batch update operation. In
addition to the information provided by SQLException, a BatchUpdateExce ption
provides the update counts for all commands that were executed successfully
during the batch update, that is, all commands that were executed before the
error occurred. The order of elements in an array of update counts
corresponds to the order in which commands were added to the batch.

After a command in a batch update fails to execute properly and a
BatchUpdateExce ption is thrown, the driver may or may not continue to
process the remaining commands in the batch. If the driver continues
processing after a failure, the array returned by the method
BatchUpdateExce ption.getUpdate Counts will have an element for every command
in the batch rather than only elements for the commands that executed
successfully before the error. In the case where the driver continues
processing commands, the array element for any command that failed is -3.

I remember seeing that the ibm db2 drivers sometimes uses -2, -3 values.
I guess it's the kind of driver that continues processing on error...
although i'm not sure.

PM
Nov 12 '05 #3

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

Similar topics

0
6259
by: mdh | last post by:
I am trying to learn the basics of MVC applications using a Tomcat infrastructure. I'm starting by building a simple application with: * a login.jsp page for a basic login form with a action pointing to "loginValidate.jsp" * a loginValidate.jsp page that references logic to validate requests * a loginBean class used to pass info between the JSP and validation logic * a usersDAO class used to perform lookups in a USERS
1
3831
by: Howie Goodell | last post by:
Hello -- I am trying to optimise a JDBC connection and an Oracle 9i database for reading millions of records at a time to a 1 Gig PC running Win2K or XP. Two questions: 1. Does anyone have suggestions for optimising an Oracle 9i server (Enterprise Edition, Release 2) for networked read-only JDBC access with large return sets? With default settings MySQL reads 1M records 2.5 times faster than Oracle even on its first, non-cached...
5
10394
by: Steve | last post by:
Hi; I went to the microsoft site to try to find a guide to the error messages that the jdbc drivers give ( for sqlserver 2000 ). I had no luck. Does anyone know if there is such a guide? I got this mysterious error message below in my logs ( nothing visible
1
2021
by: bogachkov | last post by:
Hello Joe Over the past several years, I have found your responses to jdbc usage/driver related issues to be extremely helpful. I am sure that you're very busy so I will make my question as brief as possible - the reason I didn't post this to a newsgroup is that I don't want to hear any more hype or links to benchmarks (since the vast majority of the benchmarks don't test concurent/mixed-transaction environments). (I am also posting a...
4
6336
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...
3
13364
by: r_stringer66 | last post by:
Hi, I am trying to connect to a db2 database via a jdbc application and this is the following error I get: Exception : CLI0615E Error receiving from socket, server is not responding. SQLSTATE=08S01 Below is the following code I am using. I did not specify the port number but even when I try specify it I get the same error.
0
1451
by: usenet | last post by:
Hi. I have a DB2 stored procedure that I call using JDBC. Now I'm trying to batch the call. This is done by the book: stmt = connection.prepareCall(" ... "); stmt.setString(1, "foo"); stmt.addBatch();
3
2059
by: Klint Gore | last post by:
Does anyone know of a mailing list for application developers using postgres? It'd probably be more relevant than pgsql-general for my question. Failing that, what do people use to generate reports with a postgres back end? I have a requirement to produce a reporting daemon on linux that doesn't require X windows (has to render the report and write it back to a blob). I've been down a couple of paths that ended with...
1
2610
by: kommaraju | last post by:
iam a starter to db2 & jdbc.i have a servlet program which connects to ibm db2 using jdbc.when i run this using apache tomcat 4.1.34 , it is showing a error message of HTTP STATUS 500 my jdbc program is as follows import java.sql.*; import java.lang.*; import java.io.*; import java.util.*;
0
8063
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8003
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
8478
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
6817
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5476
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3962
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...
0
4025
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1598
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1331
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.