spring-framework / org.springframework.jdbc.support / SQLErrorCodeSQLExceptionTranslator / <init>

<init>

SQLErrorCodeSQLExceptionTranslator()

Constructor for use as a JavaBean. The SqlErrorCodes or DataSource property must be set.

SQLErrorCodeSQLExceptionTranslator(dataSource: DataSource)

Create a SQL error code translator for the given DataSource. Invoking this constructor will cause a Connection to be obtained from the DataSource to get the metadata.

Parameters

dataSource - DataSource to use to find metadata and establish which error codes are usable

See Also
SQLErrorCodesFactory

SQLErrorCodeSQLExceptionTranslator(dbName: String)

Create a SQL error code translator for the given database product name. Invoking this constructor will avoid obtaining a Connection from the DataSource to get the metadata.

Parameters

dbName - the database product name that identifies the error codes entry

See Also
SQLErrorCodesFactoryjava.sql.DatabaseMetaData#getDatabaseProductName()

SQLErrorCodeSQLExceptionTranslator(sec: SQLErrorCodes)

Create a SQLErrorCode translator given these error codes. Does not require a database metadata lookup to be performed using a connection.

Parameters

sec - error codes