Meaningless Drivel is fun!
The moose likes JDBC and Relational Databases and the fly likes Handling Different type of java.sql.SQLException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Handling Different type of java.sql.SQLException" Watch "Handling Different type of java.sql.SQLException" New topic

Handling Different type of java.sql.SQLException

Jay Shukla
Ranch Hand

Joined: Jun 08, 2008
Posts: 214
Hi All,

I need to handle sqlexcpetion and show the specific error message to the user, due to which perticular scenario this exception has been thrown.
Can anyone please help where would i get these information?

Thanks in Advance.
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 45302
The SQLException class has methods which give you all that information. There are additional data in SQLException which are not available in ordinary Exceptions; you would have to check the documentation of the database you are using for their details.

This is not a "beginning Java™⅛ question, so I shall move it to our databases forum.
I agree. Here's the link:
subject: Handling Different type of java.sql.SQLException
It's not a secret anymore!