JDBCExecuteStatementDataSink
The JDBCExecuteStatementDataSink
is used to execute an arbitrary SQL statement. The statement is compiled when the data sink is opened. Parameters can be used to fine tune the runtime behavior. The parameter values are deferred expression which are evaluated when an object is exported. This module is tested with the JDBC drivers for Oracle, PostgreSQL and MariaDB databases, so it officially only supports MariaDB and Oracle databases.
Configuration
Name | Type, usage constraints, defaults | Description |
---|---|---|
statement | required: paraVal default: none type: string | The SQL statement to execute. Use "?" for placeholders of parameters. |
statementParameter | optional: paraList default: none type: list of values | Values for every question mark parameter given in the statement clause. |
datasource | required: paraVal default: none type: javax.sql.DataSource | A reference to a javax.sql.DataSource object. It defines either a JDBCConnectionPool defined in some initialization section of the configuration file or it refers to a javax.sql.DataSource provided programmatically by the client application and which is put into the configuration registry. |
autoCommit | optional: paraVal default: false type: boolean | Determines whether a transaction is automatically committed after the export of the entity. |
Example
<dataSink type="JDBCExecuteStatementDataSink">
<dp:paraVal name="statement" value="INSERT INTO person SELECT * FROM candidate WHERE ID=?" />
<dp:paraList name="statementParameter">
<value>#{in.candidate.id}</value>
</dp:paraList>
<dp:paraVal name="datasource" value="${inst.ds}"/>
</dataSink>