• Post Reply Bookmark Topic Watch Topic
  • New Topic

JDBC Prepared Statement BatchStatement within a while loop

 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

I was told not to insert data in databse with in while loop .

Within while loop i am calling database method to insert record in a Table





Will the above will be treated as a Batch statement ??

Please reply ,
Thanks in advance
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 36027
432
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kind of. The list will be batched. It would be better to accumulate all the lists in your outer while loop though.
 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!