how to fetch only reason from java exception
when I connect to database and execute a query, then if there occurs any exception then I want to fetch only the reason of exception not the full message , so that in my log I can log only the reason of exception for example. one exception is below by applying getMessage() on exception object in catch block<br/>
[Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name 'tty'.<br/>

So I want to fetch only "Invalid object name 'tty'".<br/>

The exception will occur only due to executeUpdate() method. so exception may be anything related to database or sqlquery not just Invalid object name 'tty'.
how to fetch only reason from java exception
===

when I connect to database and execute a query, then if there occurs any exception then I want to fetch only the reason of exception not the full message , so that in my log I can log only the reason of exception for example. one exception is below by applying getMessage() on exception object in catch block<br/>
[Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name 'tty'.<br/>

So I want to fetch only "Invalid object name 'tty'".<br/>

The exception will occur only due to executeUpdate() method. so exception may be anything related to database or sqlquery not just Invalid object name 'tty'.