Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

JDBC Batch creation problem

Posted on 2012-04-07
6
674 Views
Last Modified: 2012-11-24
Hi Experts...
I have a requirement of updating a table which has about 5 million rows. So for that purpose i want to create batch statements in java and update as a bulk operation.

Right now I have 100 batches and it works fine.But when i increase the number of batches over hundred i get an exception as : com.sybase.jdbc2.jdbc.SybBatchUpdateException: JZ0BE: BatchUpdateException: Error occurred while executing batch statement: Message empty.

How can i have more batch statements in my CallableStatement object.
Please help...
0
Comment
Question by:gaugeta
  • 3
  • 2
6 Comments
 
LVL 25

Expert Comment

by:Tomas Helgi Johannsson
ID: 37821792
Hi!

The number of batches you need to use depends on the number of rows in each batch
and total number of rows that you are adding/updating to the table.
So having 100 batches does not tell me how many rows are in each batch but the error "Message empty"
tells me that you are adding a empty batch most likely due to EOF in the total number of rows.

Adding more batches is only necessary if
                [number of rows in a batch] * [number of batches] < [total number of rows to be added/updated]

Regards,
         Tomas Helgi
0
 

Author Comment

by:gaugeta
ID: 37826356
@Tomas Helgi:Thanks for the reply.
Here i am adding 100 rows to a batch statement and then executing the batch containing worth 100rows of data and I'm clearing the batch for accomodating the next hundred and so on.
I meant i could only fit 100 rows in the batch statement before execution not 100 batches.
Sorry for the confusion caused.
Please help...
0
 
LVL 25

Expert Comment

by:Tomas Helgi Johannsson
ID: 37826613
Hi!

Hmmm, increase your batch size parameter in the Sybase database as it is default 100. :)
See here for more detail
http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.help.ase_15.0.sag1/html/sag1/sag1209.htm
http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc00842.1502/html/spsysmon/X21140.htm

Regards,
    Tomas Helgi
0
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:gaugeta
ID: 37827045
@TomasHelgi:Thanks for the reply.
I took a look at the document.But the procedure to increase the same is not present anywhere.
Please help....
0
 
LVL 25

Accepted Solution

by:
Tomas Helgi Johannsson earned 500 total points
ID: 37827092
Hi!

If you look at the left side of the first link I provided then there is a link
"Setting configuration Parameters" and little lower is the "Using sp_configure" link
http://infocenter.sybase.com/help/topic/com.sybase.help.ase_15.0.sag1/html/sag1/sag196.htm

which tells you how you sett/reset these parameters. :)

Regards,
      Tomas Helgi
0
 
LVL 24

Expert Comment

by:Joe Woodhouse
ID: 37843299
If you mean the sp_configure parameter "i/o batch size", that has nothing to do with this issue. I/O batch size controls how ASE manages it's interface to the I/O system and under no circumstances affects how ASE processes result sets. As a strictly internal server-side setting it's rather unlikely to be relevant to JDBC processing.

That error message is from JDBC, it isn't a Sybase ASE error. Something is wrong in the middle layer - this isn't a database issue.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
diffSum example 4 50
Groovy problem when using SOAPUI : DispatchException occurred 7 58
sybase output only middle rows 4 31
web project error add remove 1 27
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

789 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question