Hi,
How an SQLException can be equal with a String?
mabe ex.getMessage() or ex.toString() needs to be called before comparing
with "ORA-01920" ..
Cezar
On Fri, 21 May 1999, Chris Pratt wrote:
> I don't know if you've found the error yourself, but I think you actually
> want
>
> catch(SQLException ex) {
> if (ex.equals("ORA-01920")) { <== Test the Exception, not the
> SQLException Class
> out.println("This username has already been chosen, please use another
> username");
> } else {
> other things
> }
> }//end catch
>
> (*Chris*)
>
> ----- Original Message -----
> From: Sam Rose <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, May 18, 1999 5:41 AM
> Subject: error coding
>
>
> > Hello, thanks for the help on my last question about JavaScript.
> >
> > I am trying to code my servlet so that if a certain SQL exception is
> > raised it will out put what is the problem is. The exception is for
> > when someone creates a user with the same username here's my code.
> >
> > catch(SQLException ex) {
> > if (SQLException.equals("ORA-01920")) {
> > out.println("This username has already been chosen, please
> use
> > another username");
> > }
> > else{
> > other things
> > }
> > }//end catch
> >
> > I realise I am making a static reference to a boolean object, but I
> > don't know how to over come it.
> >
> >
> ___________________________________________________________________________
> > To unsubscribe, send email to [EMAIL PROTECTED] and include in the
> body
> > of the message "signoff SERVLET-INTEREST".
> >
> > Archives: http://archives.java.sun.com/archives/servlet-interest.html
> > Resources: http://java.sun.com/products/servlet/external-resources.html
> > LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
> >
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html