JDBC Component
The jdbc: component allows you to work with databases using JDBC queries and operations via SQL text as the message payload
URI format
jdbc:dataSourceName?options
Options
Name |
Default Value |
Description |
---|---|---|
readSize |
20000 |
The default maximum number of rows that can be read by a polling query |
Result
The result is returned in the out body as a ArrayList<HashMap<String, Object>> list object with the result. The ArrayList contains the list of rows and the Map contains each row with the string key as the column name.
Samples
In the sample below we fetches the rows from the customer table.
First we register our datasource in the Camel registry as testdb:
Then we configure a route that routes to the JDBC component so the SQL will be executed, notice that we refer to the testdb datasource that was bound in the previous step:
And then we create the endpoint and sends the exchange containing the SQL query to execute in the in body. The result is returned in the out body.