4

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.

Righht now I have 100 batches aand it works fine.But when i increase the number of batches over hundred i get an exceptio 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.

Danny Beckett
  • 20,529
  • 24
  • 107
  • 134
gautam vegeta
  • 653
  • 6
  • 13
  • 28

1 Answers1

1

Not enough reputation to leave comments...but what types of statements are you batching? how many of these rows are you updating? Does the table have a primary key? How many columns in the table, and how many of those columns are you updating?

Generic answer: The JDBC framework in sybase is extremely fast. You might at least consider writing a simple procedure that receives the primary key (or other) information you're using to identify the row, along with the new values that row will be updated to as input variables. this procedure will update a single row only.

Wrap this procedure in it's own java method that handles the callablestatement, register your out error number and error message params, etc.

Then you can loop through whatever constructs you're using now to update data, and use the same java method to call the procedure to update the values row by row.

Again, i don't know the volume of what you're trying to do...but I do know if you're trying to do single row updates, this will be VERY fast.

Hotel
  • 1,361
  • 11
  • 13