The exception will contain a message via the inherited _getMessage()_ etc, if it's just display purposes you're looking for this may be enough, except for localization issues. Beyond that, if you want to get a correctly localized message or make some useful interpretation of the error code to perhaps use your own message or intelligently redirect then I think you'll have to use some kind of adaptor to map to the underlying database. Some will give you copious amounts of error codes, severity, category etc and a way to get a localized version of their own messages, others will be less helpful.

There was some effort a while ago to standardize some of the common database error codes, I don't know how far that got, but as always these standards are the lowest common subset anyway.

HTH
Brett Connor


Research labs wrote:

Thanks for your prompt response.

As you are aware, getErrorCode() method of
SQLException returns the vendor specific SQL error
code, but there is no getErrorMessage() method.  Since
this is the case, how can I get the actual error
message if I implement according to your suggestion?

Please do you have any example in which this is
implemented?  Alternatively, do you know of any site
that has an example.

Thank you.

Ola





--- Robert Taylor <[EMAIL PROTECTED]> wrote: > One
strategy is to wrap the SQLException thrown by


mySQL
in a meaningful ApplicationException which can be
caught in your action class
or declarative exception handling mechanism and
"interpretted"
into the appropriate client error message which can
be placed
in the appropriate scope (request or session) which
can in turn
be rendered in the .jsp page.

robert



-----Original Message-----
From: Research labs


[mailto:[EMAIL PROTECTED]


Sent: Saturday, July 17, 2004 8:27 AM
To: Struts Users Mailing List
Subject: outputting mysql (or any other database)


error in jsp


Can anyone please tell me the best way to get a
database error into my java code so that I can


output


the database error in a JSP etc.

My key problem is how to pass the database error


to my


Java code.

Thank you.

Ola.





___________________________________________________________ALL-NEW


Yahoo! Messenger - sooooo many all-new ways to
express


yourself http://uk.messenger.yahoo.com




---------------------------------------------------------------------


To unsubscribe, e-mail:


[EMAIL PROTECTED]


For additional commands, e-mail:


[EMAIL PROTECTED]




---------------------------------------------------------------------


To unsubscribe, e-mail:
[EMAIL PROTECTED]
For additional commands, e-mail:
[EMAIL PROTECTED]






        
        
                
___________________________________________________________ALL-NEW Yahoo! Messenger - 
sooooo many all-new ways to express yourself http://uk.messenger.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to