SQL Stored Procedure Component
Available as of Camel 2.17
The sql-stored: component allows you to work with databases using JDBC Stored Procedure queries. This component is an extension to the SQL Component but specialized for calling stored procedures.
This component uses
Maven users will need to add the following dependency to their
The SQL component uses the following endpoint URI notation:
Where template is the stored procedure template, where you declare the name of the stored procedure and the IN and OUT arguments.
You can also refer to the template in a external file on the file system or classpath such as:
Where sql/myprocedure.sql is a plain text file in the classpath with the template, as show:
You can append query options to the URI in the following format,
Declaring the stored procedure template
The template is declared using a syntax that would be similar to a Java method signature. The name of the stored procedure, and then the arguments enclosed in parenthesis. An example explains this well:
The arguments is declared by a type and then the mapping to the Camel message using simple expression. So in this example the first two parameters are IN values that are INTEGER type, that maps to the message headers. The last parameter is the OUT value, also an INTEGER type.
In SQL term the stored procedure could be declared as: