Link to home
Start Free TrialLog in
Avatar of GAUTAM
GAUTAMFlag for United States of America

asked on

JDBC Batch creation problem

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...
Avatar of Tomas Helgi Johannsson
Tomas Helgi Johannsson
Flag of Iceland image

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
Avatar of GAUTAM

ASKER

@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...
Avatar of GAUTAM

ASKER

@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....
ASKER CERTIFIED SOLUTION
Avatar of Tomas Helgi Johannsson
Tomas Helgi Johannsson
Flag of Iceland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Joe Woodhouse
Joe Woodhouse

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.