|
Home > Archive > SQL Server JDBC > February 2006 > SQLServerException and Raiserror
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
SQLServerException and Raiserror
|
|
| Shantanu 2006-02-25, 9:28 am |
| Hello,
I am bit new to SQLServer JDBC drivers. We have a database trigger that
raises a user defined exception using Raiserror.
e.g. Raiserror( 'Trigger has failed because ......
When I get SQLServerException in my Java code, I can only access the server
error that says something like below
SQL Error: 3609, SQLState: S0001
The transaction ended in the trigger. The batch has been aborted.
Is there a way I can access error message defined by me?
Many Thanks
| |
| Joe Weinstein 2006-02-25, 9:28 am |
|
Shantanu wrote:
> Hello,
>
> I am bit new to SQLServer JDBC drivers. We have a database trigger that
> raises a user defined exception using Raiserror.
> e.g. Raiserror( 'Trigger has failed because ......
>
> When I get SQLServerException in my Java code, I can only access the server
> error that says something like below
>
> SQL Error: 3609, SQLState: S0001
> The transaction ended in the trigger. The batch has been aborted.
>
> Is there a way I can access error message defined by me?
>
> Many Thanks
Make the getWarnings() call on the connection and statement, and see if
the raiserror message is attached via warnings. Also call the SQLException's
getNextException() to see if you got a chain of exceptions, with the info
you want in one of those.
Joe Weinstein at BEA Systems
| |
| Shantanu 2006-02-25, 9:28 am |
| I do not have access to connection or statement. I just get
SQLServerException thrown to me. I tried doing getCause() and
getNextException() but no luck.
Thanks
Shantanu
"Joe Weinstein" wrote:
>
>
> Shantanu wrote:
>
>
> Make the getWarnings() call on the connection and statement, and see if
> the raiserror message is attached via warnings. Also call the SQLException's
> getNextException() to see if you got a chain of exceptions, with the info
> you want in one of those.
> Joe Weinstein at BEA Systems
>
>
| |
| Joe Weinstein 2006-02-25, 9:28 am |
|
Shantanu wrote:
> I do not have access to connection or statement.
Ok, then you're out of luck unless you have access to the
JDBC objects involved...
Joe
[color=darkred]
> I just get
> SQLServerException thrown to me. I tried doing getCause() and
> getNextException() but no luck.
>
> Thanks
> Shantanu
>
> "Joe Weinstein" wrote:
>
>
|
|
|
|
|