Package org.frankframework.jdbc
Class StoredProcedureQuerySender
java.lang.Object
org.frankframework.jndi.JndiBase
org.frankframework.jdbc.JdbcFacade
org.frankframework.jdbc.AbstractJdbcSender<H>
org.frankframework.jdbc.AbstractJdbcQuerySender<QueryExecutionContext>
org.frankframework.jdbc.FixedQuerySender
org.frankframework.jdbc.StoredProcedureQuerySender
- All Implemented Interfaces:
AdapterAware
,HasPhysicalDestination
,IBlockEnabledSender<QueryExecutionContext>
,IConfigurable
,IConfigurationAware
,INamedObject
,IScopeProvider
,ISender
,ISenderWithParameters
,IWithParameters
,IXAEnabled
,HasStatistics
,org.springframework.beans.factory.Aware
,org.springframework.context.ApplicationContextAware
StoredProcedureQuerySender is used to send stored procedure queries and retrieve the result.
QueryType settings and OUTPUT parameters
The StoredProcedureQuerySender class has the following features:- It supports setting the output parameters of the stored procedure by setting 'mode' attribute of the corresponding 'Param' to 'OUTPUT' or 'INOUT'.
- The queryType can only be 'SELECT' or 'OTHER'.
- Use queryType 'SELECT' when the stored procedure only returns a set of rows, and you need
the output to be the format as
FixedQuerySender
(seeDB2XMLWriter
). - Use queryType 'OTHER' if the stored procedure has one or more output parameters. With this query type, the stored procedure can return a result-set along with returning some values in output parameters. Depending on the database, the stored procedure can even returning multiple result sets or a combination of result sets as return values, and result sets as REF_CURSOR OUT parameters.
All stored procedure parameters that are not fixed, so specified in the query with a ?
, should
have a corresponding IParameter
entry. Output parameters should have mode="OUTPUT"
, or
mode="INOUT"
depending on how the stored procedure is defined.
Sample Output for queryType=OTHER
Basic Example with Only Simple Output Parameters
<resultset>
<result param="r1" type="STRING">MESSAGE-CONTENTS</result>
<result param="r2" type="STRING">E</result>
</resultset>
Example with Resultset and Simple Output Parameters
<resultset>
<result resultNr="1">
<fielddefinition>
<field name="FIELDNAME"
type="columnType"
columnDisplaySize=""
precision=""
scale=""
isCurrency=""
columnTypeName=""
columnClassName=""/>
<field ...../>
</fielddefinition>
<rowset>
<row number="0">
<field name="TKEY">MSG-ID</field>
<field name="TCHAR">E</field>
<field name="TMESSAGE">MESSAGE-CONTENTS</field>
<field name="TCLOB" null="true"/>
<field name="TBLOB" null="true"/>
</row>
<row number="1" ...../>
</rowset>
</result>
<result param="count" type="INTEGER">5</result>
</resultset>
Example with Simple and Cursor Output Parameters
<resultset>
<result param="count" type="INTEGER">5</result>
<result param="cursor1" type="LIST">
<fielddefinition>
<field name="FIELDNAME"
type="columnType"
columnDisplaySize=""
precision=""
scale=""
isCurrency=""
columnTypeName=""
columnClassName=""/>
<field ...../>
</fielddefinition>
<rowset>
<row number="0">
<field name="TKEY">MSG-ID</field>
<field name="TCHAR">E</field>
<field name="TMESSAGE">MESSAGE-CONTENTS</field>
<field name="TCLOB" null="true"/>
<field name="TBLOB" null="true"/>
</row>
<row number="1" ..... />
</rowset>
</result>
</resultset>
- Since:
- 7.9
- Parameters
- All parameters present are applied to the query to be executed.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.frankframework.jdbc.AbstractJdbcQuerySender
AbstractJdbcQuerySender.QueryType
-
Field Summary
Fields inherited from class org.frankframework.jdbc.AbstractJdbcQuerySender
UNP_END, UNP_START
Fields inherited from class org.frankframework.jdbc.AbstractJdbcSender
connection, paramList
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
configure()
is called once at startup of the framework in the configure method of the owner of this sender.protected Message
executeOtherQuery
(Connection connection, PreparedStatement statement, String query, String resultQuery, PreparedStatement resStmt, Message message, PipeLineSession session, ParameterList parameterList) protected PreparedStatement
prepareQueryWithColumnsReturned
(Connection con, String query, String[] columnsReturned) protected PreparedStatement
prepareQueryWithResultSet
(Connection con, String query, int resultSetConcurrency) void
setAvoidLocking
(boolean avoidLocking) This feature is not supported for StoredProcedureQuerySender.void
This feature is not supported for StoredProcedureQuerySender.void
setBlobCharset
(String string) This feature is not supported for StoredProcedureQuerySender.void
setBlobColumn
(int i) This feature is not supported for StoredProcedureQuerySender.void
setBlobsCompressed
(boolean b) This feature is not supported for StoredProcedureQuerySender.void
setBlobSessionKey
(String string) This feature is not supported for StoredProcedureQuerySender.void
setBlobSmartGet
(boolean b) This feature is not supported for StoredProcedureQuerySender.void
setClobColumn
(int i) This feature is not supported for StoredProcedureQuerySender.void
setClobSessionKey
(String string) This feature is not supported for StoredProcedureQuerySender.void
setColumnsReturned
(String string) This feature is not supported for StoredProcedureQuerySender.void
setLockRows
(boolean b) This feature is not supported for StoredProcedureQuerySender.void
setLockWait
(int i) This feature is not supported for StoredProcedureQuerySender.void
setMaxRows
(int i) This feature is not supported for StoredProcedureQuerySender.void
A SQL statement that calls a stored procedure.void
setQueryType
(AbstractJdbcQuerySender.QueryType queryType) The query type.void
setRowIdSessionKey
(String string) This feature is not supported for StoredProcedureQuerySender.void
setStartRow
(int i) This feature is not supported for StoredProcedureQuerySender.Methods inherited from class org.frankframework.jdbc.FixedQuerySender
closeBlock, closeStatementSet, getBatchSize, getQuery, getQuery, openBlock, sendMessage, setBatchSize
Methods inherited from class org.frankframework.jdbc.AbstractJdbcQuerySender
adjustQueryAndParameterListForNamedParameters, buildDb2XMLWriter, closeConnectionForSendMessage, convertQuery, executeOtherQuery, executePackageQuery, executeSelectQuery, executeStatementSet, executeUpdateBlobQuery, executeUpdateClobQuery, fillParamArray, getBlobBase64Direction, getBlobCharset, getBlobColumn, getBlobSessionKey, getCallWithRowIdReturned, getClobColumn, getClobSessionKey, getColumnsReturned, getColumnsReturnedList, getConnectionForSendMessage, getLockWait, getMaxRows, getNullValue, getOutputFormat, getPackageContent, getQueryExecutionContext, getQueryType, getResult, getResult, getResult, getResultQuery, getReturnedColumns, getRowIdSessionKey, getSqlDialect, getStartRow, getStatement, getStreamCharset, getUpdateStatementResult, getUseNamedParams, isAvoidLocking, isBlobsCompressed, isBlobSmartGet, isCloseInputstreamOnExit, isCloseOutputstreamOnExit, isIncludeFieldDefinition, isLockRows, isPrettyPrint, isScalar, isScalarExtended, isStreamResultToServlet, isSynchronous, isTrimSpaces, prepareQuery, setCloseInputstreamOnExit, setCloseOutputstreamOnExit, setIncludeFieldDefinition, setNullValue, setOutputFormat, setPackageContent, setPrettyPrint, setResultQuery, setScalar, setScalarExtended, setSqlDialect, setStreamCharset, setStreamResultToServlet, setSynchronous, setTrimSpaces, setUseNamedParams, start
Methods inherited from class org.frankframework.jdbc.AbstractJdbcSender
addParameter, getAdapter, getConnection, getParameterList, getTimeout, sendMessage, setAdapter, setConfigurationMetrics, setTimeout, stop, toString
Methods inherited from class org.frankframework.jdbc.JdbcFacade
getAuthAlias, getConnectionWithTimeout, getDatasource, getDataSourceFactory, getDatasourceInfo, getDatasourceName, getDbmsSupport, getDomain, getLogPrefix, getPassword, getPhysicalDestinationName, getUsername, isConnectionsArePooled, isTransacted, setAuthAlias, setConnectionsArePooled, setDataSourceFactory, setDatasourceName, setDbmsSupportFactory, setJmsRealm, setPassword, setTransacted, setUsername
Methods inherited from class org.frankframework.jndi.JndiBase
getApplicationContext, getAuthentication, getConfigurationClassLoader, getContext, getCredentials, getInitialContextFactoryName, getJmsRealmName, getJndiAuthAlias, getJndiContextPrefix, getJndiEnv, getJndiProperties, getName, getPrincipal, getProviderURL, getSecurityProtocol, getUrlPkgPrefixes, setApplicationContext, setAuthentication, setCredentials, setInitialContextFactoryName, setJndiAuthAlias, setJndiContextPrefix, setJndiProperties, setName, setPrincipal, setProviderURL, setSecurityProtocol, setUrlPkgPrefixes
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.springframework.context.ApplicationContextAware
setApplicationContext
Methods inherited from interface org.frankframework.core.IConfigurationAware
getApplicationContext, getName
Methods inherited from interface org.frankframework.core.INamedObject
getName, setName
Methods inherited from interface org.frankframework.core.IScopeProvider
getConfigurationClassLoader
Methods inherited from interface org.frankframework.core.ISender
sendMessageOrThrow
Methods inherited from interface org.frankframework.core.ISenderWithParameters
consumesSessionVariable
-
Constructor Details
-
StoredProcedureQuerySender
public StoredProcedureQuerySender()
-
-
Method Details
-
configure
Description copied from interface:ISender
configure()
is called once at startup of the framework in the configure method of the owner of this sender. Purpose of this method is to check whether the static configuration of the sender is correct. As much as possible class-instantiating should take place in theconfigure()
oropen()
method, to improve performance.- Specified by:
configure
in interfaceIConfigurable
- Specified by:
configure
in interfaceISender
- Overrides:
configure
in classFixedQuerySender
- Throws:
ConfigurationException
-
prepareQueryWithResultSet
protected PreparedStatement prepareQueryWithResultSet(Connection con, String query, int resultSetConcurrency) throws SQLException - Overrides:
prepareQueryWithResultSet
in classAbstractJdbcQuerySender<QueryExecutionContext>
- Throws:
SQLException
-
prepareQueryWithColumnsReturned
protected PreparedStatement prepareQueryWithColumnsReturned(Connection con, String query, String[] columnsReturned) throws SQLException - Overrides:
prepareQueryWithColumnsReturned
in classAbstractJdbcQuerySender<QueryExecutionContext>
- Throws:
SQLException
-
executeOtherQuery
protected Message executeOtherQuery(Connection connection, PreparedStatement statement, String query, String resultQuery, PreparedStatement resStmt, Message message, PipeLineSession session, ParameterList parameterList) throws SenderException - Overrides:
executeOtherQuery
in classAbstractJdbcQuerySender<QueryExecutionContext>
- Throws:
SenderException
-
setQuery
A SQL statement that calls a stored procedure. The statement should begin with theCALL
orEXEC
SQL keyword depending on SQL dialect. In case of doubt, the safe choice is to always start withCALL
and choose Oracle dialect.- Overrides:
setQuery
in classFixedQuerySender
- Parameters:
query
- The SQL statement to invoke the stored procedure.
-
setQueryType
The query type. For stored procedures, valid query types areAbstractJdbcQuerySender.QueryType.SELECT
andAbstractJdbcQuerySender.QueryType.OTHER
. UseAbstractJdbcQuerySender.QueryType.SELECT
when your stored procedure returns a row set (not supported by Oracle and PostgreSQL). UseAbstractJdbcQuerySender.QueryType.OTHER
when your stored procedure returns values viaOUT
orINOUT
parameters, or does not return anything at all.Using any other value will be rejected.
- Overrides:
setQueryType
in classAbstractJdbcQuerySender<QueryExecutionContext>
- Parameters:
queryType
- The queryType.
-
setColumnsReturned
This feature is not supported for StoredProcedureQuerySender.- Overrides:
setColumnsReturned
in classAbstractJdbcQuerySender<QueryExecutionContext>
-
setLockRows
public void setLockRows(boolean b) This feature is not supported for StoredProcedureQuerySender.- Overrides:
setLockRows
in classAbstractJdbcQuerySender<QueryExecutionContext>
-
setLockWait
public void setLockWait(int i) This feature is not supported for StoredProcedureQuerySender.- Overrides:
setLockWait
in classAbstractJdbcQuerySender<QueryExecutionContext>
-
setBlobColumn
public void setBlobColumn(int i) This feature is not supported for StoredProcedureQuerySender.- Overrides:
setBlobColumn
in classAbstractJdbcQuerySender<QueryExecutionContext>
-
setBlobSessionKey
This feature is not supported for StoredProcedureQuerySender.- Overrides:
setBlobSessionKey
in classAbstractJdbcQuerySender<QueryExecutionContext>
-
setBlobsCompressed
public void setBlobsCompressed(boolean b) This feature is not supported for StoredProcedureQuerySender.- Overrides:
setBlobsCompressed
in classAbstractJdbcQuerySender<QueryExecutionContext>
-
setBlobBase64Direction
This feature is not supported for StoredProcedureQuerySender.- Overrides:
setBlobBase64Direction
in classAbstractJdbcQuerySender<QueryExecutionContext>
-
setBlobCharset
This feature is not supported for StoredProcedureQuerySender.- Overrides:
setBlobCharset
in classAbstractJdbcQuerySender<QueryExecutionContext>
-
setBlobSmartGet
public void setBlobSmartGet(boolean b) This feature is not supported for StoredProcedureQuerySender.- Overrides:
setBlobSmartGet
in classAbstractJdbcQuerySender<QueryExecutionContext>
-
setClobColumn
public void setClobColumn(int i) This feature is not supported for StoredProcedureQuerySender.- Overrides:
setClobColumn
in classAbstractJdbcQuerySender<QueryExecutionContext>
-
setClobSessionKey
This feature is not supported for StoredProcedureQuerySender.- Overrides:
setClobSessionKey
in classAbstractJdbcQuerySender<QueryExecutionContext>
-
setAvoidLocking
public void setAvoidLocking(boolean avoidLocking) This feature is not supported for StoredProcedureQuerySender.- Overrides:
setAvoidLocking
in classAbstractJdbcQuerySender<QueryExecutionContext>
-
setMaxRows
public void setMaxRows(int i) This feature is not supported for StoredProcedureQuerySender.- Overrides:
setMaxRows
in classAbstractJdbcQuerySender<QueryExecutionContext>
-
setStartRow
public void setStartRow(int i) This feature is not supported for StoredProcedureQuerySender.- Overrides:
setStartRow
in classAbstractJdbcQuerySender<QueryExecutionContext>
-
setRowIdSessionKey
This feature is not supported for StoredProcedureQuerySender.- Overrides:
setRowIdSessionKey
in classAbstractJdbcQuerySender<QueryExecutionContext>
-