Using Java 6, how do you loop through the causes of a SQL Exception?

John Zukowski

The SQLException class is now Iterable in Java 6.

try {

...

} catch (SQLException sqle) {

  for(Throwable t : sqle) {

    System.out.println("Throwable: " + t);

  }

}
0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact