...
Name | Default Value | Description |
---|---|---|
| | The default maximum number of rows that can be read by a polling query. The default value is 0. |
| | Camel 2.1: Sets additional options on the |
| | Camel 2.2: Sets whether to use JDBC 4/3 column label/name semantics. You can use this option to turn it |
| | Camel 2.9: Camel will set the autoCommit on the JDBC connection to be false, commit the change after executed the statement and reset the autoCommit flag of the connection at the end, if the resetAutoCommit is true. If the JDBC connection doesn't support to reset the autoCommit flag, you can set the resetAutoCommit flag to be false, and Camel will not try to reset the autoCommit flag. |
| | Camel 2.12: Whether to allow using named parameters in the queries. |
|
| Camel 2.12: Allows to plugin to use a custom |
| | Camel 2.12: Set this option to |
Result
The result is returned in the OUT body as an ArrayList<HashMap<String, Object>>
. The List
object contains the list of rows and the Map
objects contain each row with the String
key as the column name.
...
Header | Description |
---|---|
| If the query is a |
| If the query is an |
| Camel 2.10: Rows that contains the generated kets. |
| Camel 2.10: The number of rows in the header that contains generated keys. |
| Camel 2.11.1: The column names from the ResultSet as a |
| Camel 2.12: A |
Generated keys
Available as of Camel 2.10
...
You can see more details in this unit test.
Info |
---|
Using generated keys does not work with together with named parameters. |
Using named parameters
Available as of Camel 2.12
In the given route below, we want to get all the projects from the projects table. Notice the SQL query has 2 named parameters, :#lic and :#min.
Camel will then lookup for these parameters from the message body or message headers. Notice in the example above we set two headers with constant value
for the named parameters:
Code Block |
---|
from("direct:projects")
.setHeader("lic", constant("ASF"))
.setHeader("min", constant(123))
.setBody("select * from projects where license = :#lic and id > :#min order by id")
.to("jdbc:myDataSource?useHeadersAsParameters=true")
|
You can also store the header values in a java.util.Map
and store the map on the headers with the key CamelJdbcParameters
.
Samples
In the following example, we fetch the rows from the customer table.
...