Example usage for org.springframework.jdbc.support SQLErrorCodesFactory getInstance

List of usage examples for org.springframework.jdbc.support SQLErrorCodesFactory getInstance

Introduction

In this page you can find the example usage for org.springframework.jdbc.support SQLErrorCodesFactory getInstance.

Prototype

public static SQLErrorCodesFactory getInstance() 

Source Link

Document

Return the singleton instance.

Usage

From source file:org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.java

/**
 * Set the DataSource for this translator.
 * <p>Setting this property will cause a Connection to be obtained from
 * the DataSource to get the metadata.//from  w  w w. ja va 2  s  .c om
 * @param dataSource DataSource to use to find metadata and establish
 * which error codes are usable
 * @see SQLErrorCodesFactory#getErrorCodes(javax.sql.DataSource)
 * @see java.sql.DatabaseMetaData#getDatabaseProductName()
 */
public void setDataSource(DataSource dataSource) {
    this.sqlErrorCodes = SQLErrorCodesFactory.getInstance().getErrorCodes(dataSource);
}

From source file:org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.java

/**
 * Set the database product name for this translator.
 * <p>Setting this property will avoid obtaining a Connection from the DataSource
 * to get the metadata.//from ww  w .j  a va 2s . co m
 * @param dbName the database product name that identifies the error codes entry
 * @see SQLErrorCodesFactory#getErrorCodes(String)
 * @see java.sql.DatabaseMetaData#getDatabaseProductName()
 */
public void setDatabaseProductName(String dbName) {
    this.sqlErrorCodes = SQLErrorCodesFactory.getInstance().getErrorCodes(dbName);
}