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
[Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name 'tty'.
So I want to fetch only "Invalid object name 'tty'".
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'.