How to handle Exceptions at Database end?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   RV_RamaKrishna
Posted On:   Saturday, April 23, 2005 07:10 AM


I am having an aplication say database oriented.Suppose i am getting some SQLException.I don't want to show this exception to my client as he cannot understand, instead i want to make use of other page say page "displaying Sorry some problem occurs plz try after some time".How can i acheive this.In short how to handle these type of exceptions.

Plz let me know.A sample code will be of great help.

Thanks in advance.

Re: How to handle Exceptions at Database end?

Posted By:   Joost_Schouten  
Posted On:   Saturday, April 23, 2005 01:07 PM

This has very little to do with JDBC. All you need to do is create a try catch block in your servlet or JSP. Something like this.



try{
//your JDBC code here
}catch(SQLException sqle){
//log your sqle some whay or the other so you know about it
//forward the request to your error page with a userfriendly message
}

Also, you can set the errorPage directive in your JSP's if you are using a JSP to run your JDBC code from.


Hope this helps,

Cheers,

Joost

About | Sitemap | Contact