aspose file tools*
The moose likes JDBC and the fly likes How to catch sybase raiseerror in java ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "How to catch sybase raiseerror in java ? " Watch "How to catch sybase raiseerror in java ? " New topic
Author

How to catch sybase raiseerror in java ?

Shan Tiruvarur
Greenhorn

Joined: Feb 14, 2005
Posts: 5
assume i am doing this

query= "exec <stored proc name>"
stmt.execute(query)

now, this is a single line stored proc.
...
begin
raiseerror 100001
end
...
...

how do i catch this raiseerror thing back in java ?
i tried catching SQLException but
raiseerror is not wrapped into SQLException.

can someone help me with this ?
thanks.
Steve Knott
Greenhorn

Joined: Apr 26, 2004
Posts: 2
set nocount on in the sp.
The error code should now be in the resultset on the statement.
perform a ResultSet.next() and getInt()
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to catch sybase raiseerror in java ?