You could do that - that's not what I mentioned, but on second thought that's a better option for you. Might look like this:
Code:
public class CustomErrorCodesTranslator
extends SQLErrorCodeSQLExceptionTranslator {
protected DataAccessException customTranslate(String task, String sql,
SQLException sqlex) {
if (sqlex.getErrorCode() == 0 && "JZ006".equals(sqlex.getSQLState())) {
return new DataAccessResourceFailureException("Database down", sqlex);
}
return null;
}
}
And then you would have to set this on the JdbcTemplate you are using.