Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

With respect to Batch execution in JDBC

 
PavanPL KalyanK
Ranch Hand
Posts: 212
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Hello ,

I am doing insertion operation so keeping all the statements in Batch . On this some statements execute and some are failing .

If a single statement fails , a BatchUpdateException is caught and all other statements are rolled back .

what should i do to in order to accomplish let other statements execute even if some fail.



waiting for your suggestions.

 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do not execute them in batch then, but one by one.
 
PavanPL KalyanK
Ranch Hand
Posts: 212
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bauke Scholtz wrote:Do not execute them in batch then, but one by one.


Then what is the use of doing addBatch ?? How can i take the advantage of BatchStatements.
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is just intented to execute a batch in the DB? Or don't you understand what a batch concerns?
 
PavanPL KalyanK
Ranch Hand
Posts: 212
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


I did not get what you mean to say.

Assume this my piece of code . Could you please suggest what are trying to suggest.
 
PavanPL KalyanK
Ranch Hand
Posts: 212
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks , i got the solution .
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic