The RelationalDatabase
data connector generates multiple attributes from a relational database via a JDBC DataSource. The attributes are generated such that each attribute represents a column of the query result set. The ordered values represent the rows of the result set and each attribute will contain the same number of values, including any embedded nulls in the results. Nulls are represented explicitly with objects of type EmptyAttributeValue (note, this is a change from V2, which exposed null values as Java nulls in the attribute value collections).
...
Name | Type | Default | Description |
---|---|---|---|
| boolean | false | Controls whether an empty result set is an error |
| Bean ID | Bean ID of a MappingStrategy<java.sql.ResultSet> to process the result set in a pluggable way | |
validatorRef 3.2 | Bean ID | Bean ID of a Validator to control what constitutes an initialization failure (set this to "shibboleth.NonFailFastValidator" to bypass connection attempt at config load time) | |
executableSearchBuilderRef 3.4 | Bean ID | Bean ID of an ExecutableSearchBuilder<ExecutableStatement> to produce the SQL query to execute | |
| boolean | false | Controls whether a result set with more than one row is an error |
| XML Duration or milliseconds | Timeout for the queries made against the database | |
| Bean ID | Bean ID of a org.apache.velocity.app.VelocityEngine to use for processing the SQL template | |
readOnlyConnection | boolean | true | Whether the DataConnector should be marked as readonly. If the DataConnector is shared with a subsystem which requires write access (via a <BeanManagedConnection>) this must bet set to false. |
...
Name | Cardinality | Description |
---|---|---|
Not permitted if the | Connects to a database via a JNDI DataSource defined in the container | |
Connects to a database via a JDBC DataSource defined explicitly with a simplified syntax. | ||
Connects to a database via a JDBC DataSource defined explicitly | ||
Connects to a database via an externally specified javax.sql.DataSource | ||
0 or 1 | The template of the SQL query to send to the database | |
0 or more | A series of remapping definitions which map a column name to an IdPAttribute ID | |
0 or 1 | Defines how results should be cached | |
| Bean ID (in the element content) defining how results should be cached as an externally defined com.google.common.cache.Cache<String,Map<String,IdPAttribute>> |
Externally (Spring) Defined Content
If the springResource
or springResourceRef
attributes are specified, then the configuration of the data connector bean is delegated to the supplied resources. The system will create a factory for an RDBMSDataConnector object, and look for beans in the Spring resource(s) supplied that match the types of properties supported by that type and its parent classes. Note that since these are not public, but implementation classes, they are subject to change, which creates some risk during non-patch upgrades, so you must take additional precautions to use this feature.
In practice, the RDBMS Data Connector may be supplied with beans of the following types:
- DataSource
- ExecutableSearchBuilder<ExecutableStatement>
- com.google.common.cache.Cache<String,Map<String,IdPAttribute>>
- Validator
- MappingStrategy<ResultSet>
In addition native bean IDs can be injected as follows:
- The data source can be specified as an externally defined bean via the
<BeanManagedConnection>
element (as a recommended replacement for either the<ContainerManagedConnection>
or<ApplicationManagedConnection>
elements). - (3.4+) The builder for the SQL query can be specified as an externally defined bean via the
executableSearchBuilderRef
attribute (as a replacement for the<QueryTemplate>
element). - The mapping of column names can be specified as an externally defined bean via the
mappingStrategyRef
attribute (as a replacement for the<Column>
elements). - The caching of results can be specified as an externally defined bean via the
<ResultCacheBean>
element (as a replacement for the<ResultCache>
element). - Rarely, a non-default Velocity engine can be injected via the
templateEngine
attribute.
...
- Use of a Spring file to define the various low-level objects, which could be referenced via
<DataConnector " xsi:type="RelationalDatabase" springResources="....." />
- Use of a Spring file to define a data source which could be referenced via
<BeanManagedConnection>dataSource</BeanManagedConnection>
- Use of the DBCP pooling library to wrap a database driver in a simple pool.
...