aspose file tools*
The moose likes Beginning Java and the fly likes SQLException insight Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "SQLException insight" Watch "SQLException insight" New topic
Author

SQLException insight

Jon Camilleri
Ranch Hand

Joined: Apr 25, 2008
Posts: 659

SQLException

Does the following code block suffice to capture all the stack of exceptions that might be generated from SQLException? How does it work under the hood?
Why is it useful to retrieve .getNextException()?
Can you provide an example where this was useful?



Sourced from Core Java Volume 2 (7th Ed), Chapter 4.


Jon
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19544
    
  16

You can execute more than one SQL statement at once; either by separating the statements using ; inside the (Prepared)Statement or by using (Prepared)Statement's batch functionality. For instance, it's possible to execute two UPDATE statements at once. Those two statements can each produce their own error. This is done by this form of exception chaining.
For instance:


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SQLException insight
 
Similar Threads
Life of the JDBC-ODBC Connection object in a Thread??
finally block is not executing
ERROR CODE -4,499 DB2
Oracle JDBC Missing IN or OUT parameters
Question on closing ResultSets