*
The moose likes JDBC and the fly likes addBatch() for a PreparedStatement Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "addBatch() for a PreparedStatement" Watch "addBatch() for a PreparedStatement" New topic
Author

addBatch() for a PreparedStatement

Tracey Currier
Ranch Hand

Joined: Feb 06, 2001
Posts: 50
my driver supports batch updates(Sybase jconnect),
I can execute the update with one row inserting
but not multiple rows,
the batching is not working,
does anyone know why?
Thanks


MS,MS,SCJP,SCBCD Seize the day!
Jamie Robertson
Ranch Hand

Joined: Jul 09, 2001
Posts: 1879

Originally posted by Tracey Currier:
my driver supports batch updates(Sybase jconnect),
I can execute the update with one row inserting
but not multiple rows,
the batching is not working,
does anyone know why?
Thanks

a small code snippet would help us give you more accurate advice. I've not had any problems with jconnect yet.
Jamie
Jamie Robertson
Ranch Hand

Joined: Jul 09, 2001
Posts: 1879

however, my guess is that you do are doing something like the following:

OR

Jamie
[ October 10, 2003: Message edited by: Jamie Robertson ]
Tracey Currier
Ranch Hand

Joined: Feb 06, 2001
Posts: 50
Thanks for your reply, I did make that error you suggested, but
I had corrected with still no pos results.
I found the error, at least to some extent.
I can add 10 lines of my prepared statement w/o problems,
but when I try 50, I run into problems.
Due to time issues, we decided to print tab delimited data files
and "bcp" them to the db.
I am looking forward to reading the book, got lucky, can use the info
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: addBatch() for a PreparedStatement
 
Similar Threads
problem with BatchUpdateException
Batch Update
read large CSV file and update the database
Best way to insert 10000 rows in JDBC
inserting values from arraylist to the database