• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Java

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If i do executeBatch() on a statement, which contains some erroneous records to be inserted, then in case of Oracle it is throwing SQLException instead of BatchUpdateException. If you execute the same using SQL server database, it throws BatchUpdateException. Why the behaviour is different in SQL server and in Oracle?
 
Author
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Anil,
<code>BatchUpdateException</code> extends <code>SQLException</code>. How did you find out that it was throwing <code>SQLException</code>? I mean, does it say so in the stack trace, or anywhere else?

------------------
Bjarki Holm
 
Anil Kumarknr
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually i am doing stmt.executeBatch(), and cathing BatchUpdateException as well as SQLException. It is something like this.
try {
stmt.executeBatch();
} catch(BatchUpdateException buex) {
// some code
} catch(SQLException sqle) {
// some code
} catch(Exception e) {
// some code
}
If i am executing the above code using SQL server driver then control is coming to BatchUpdateException ( i am using Sprinta2000 SQL Server Driver here). If it is Oracle Driver (oracle.jdbc.driver.OracleDriver) then control is coming to SQLException. If i say sqle.getMessage() here,in the stack trace it is printing as "oracle.jdbc2.BatchUpdateException". I want to be consistent in both cases.
 
Ranch Hand
Posts: 358
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
May be its dependent on the type of driver used.
 
It is difficult to free fools from the chains they revere - Voltaire. tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic