Skip to content
Advertisement

Is insert.addBatch() accessible outside of this for loop?

I have multiple for loops where I am setting the values to be inserted into a MySQL DB.
My question is will insert.addBatch(); detect the insert values if it is outside of the for loop. Below is an example:

Edit: Added extra code above to show that I am casting from a list to a string to obtain the values. I am not sure if this will change the approach to the question.

Advertisement

Answer

If you use Iterators, this inserts as much records as possible

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement