Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to catch sybase raiseerror in java ?  RSS feed

 
Shan Tiruvarur
Greenhorn
Posts: 5
  • 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
  • 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
Boost this thread!