JDBC Batch creation problem

Posted on 2012-04-07
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...
Question by:gaugeta
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
  • 3
  • 2
LVL 25

Expert Comment

by:Tomas Helgi Johannsson
ID: 37821792

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]

         Tomas Helgi

Author Comment

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...
LVL 25

Expert Comment

by:Tomas Helgi Johannsson
ID: 37826613

Hmmm, increase your batch size parameter in the Sybase database as it is default 100. :)
See here for more detail

    Tomas Helgi
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users


Author Comment

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....
LVL 25

Accepted Solution

Tomas Helgi Johannsson earned 500 total points
ID: 37827092

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

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

      Tomas Helgi
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.

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

617 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