List of usage examples for org.springframework.jdbc.support SQLErrorCodes getDatabaseProductNames
@Nullable
public String[] getDatabaseProductNames()
From source file:org.springframework.jdbc.support.SQLErrorCodesFactory.java
/** * Return the {@link SQLErrorCodes} instance for the given database. * <p>No need for a database metadata lookup. * @param databaseName the database name (must not be {@code null}) * @return the {@code SQLErrorCodes} instance for the given database * @throws IllegalArgumentException if the supplied database name is {@code null} *///from w ww .ja v a 2s . c o m public SQLErrorCodes getErrorCodes(String databaseName) { Assert.notNull(databaseName, "Database product name must not be null"); SQLErrorCodes sec = this.errorCodesMap.get(databaseName); if (sec == null) { for (SQLErrorCodes candidate : this.errorCodesMap.values()) { if (PatternMatchUtils.simpleMatch(candidate.getDatabaseProductNames(), databaseName)) { sec = candidate; break; } } } if (sec != null) { checkCustomTranslatorRegistry(databaseName, sec); if (logger.isDebugEnabled()) { logger.debug("SQL error codes for '" + databaseName + "' found"); } return sec; } // Could not find the database among the defined ones. if (logger.isDebugEnabled()) { logger.debug("SQL error codes for '" + databaseName + "' not found"); } return new SQLErrorCodes(); }