File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to catch sybase raiseerror in java ?

 
Shan Tiruvarur
Greenhorn
Posts: 5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
set nocount on in the sp.
The error code should now be in the resultset on the statement.
perform a ResultSet.next() and getInt()
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic