This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How can i continue executing other SQL Statments , even if one of them fails

 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am executing , some sql statements , now the requirement is such that , even if a single statement execution fails ,i want to continue executng the others .

But right now the condition is such that , even if a single SQL Statement fails the execution is currently stopped at that Line .

Please let me know how can i continue executing the others even one statement fails .

Thanks


 
Rene Larsen
Ranch Hand
Posts: 1179
Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We need to see your code.

The SQL won't stop - so it is in your JDBC code the change need to be made.
 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the response :

// Assume that the Table Users doesn't exists in the firsyt select query , so it will throw an Exception SQLException , i am handling that in my code, please tell me how can i make execute the next sequence of statements also


Any ideas
 
Rene Larsen
Ranch Hand
Posts: 1179
Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to take control over the Exceptions thrown from the stmt.executeQuery(..) by wrapping them into try/catch blocks.
 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you , what i am doing is that , for all the SQL Statements i am only using one Catch Exception block of SQLException , so in this case if one is failing the rest aren't being executed.

Anyway thanks for the help .
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic