private String getSqlState ( SQLException ex ) { String result = ex . getSQLState ( ) ; SQLException nestedEx = null ; if ( result == null ) { nestedEx = ex . getNextException ( ) ; if ( nestedEx != null ) { result = nestedEx . getSQLState ( ) ; } } return result ; }
Reads SQLException hierarchy and returns SQL state .