private String getErrorCode ( SQLException ex ) { String result = null ; SQLException nestedEx = null ; if ( ex . getErrorCode ( ) != 0 ) { result = Integer . toString ( ex . getErrorCode ( ) ) ; } if ( result == null ) { nestedEx = ex . getNextException ( ) ; if ( nestedEx != null ) { result = Integer . toString ( nestedEx . getErrorCode ( ) ) ; } } return result ; }
Reads SQLException hierarchy and returns error code