JDBC

JDBC

Scheme: jdbc
Syntax: jdbc:dataSourceName
Description: The jdbc component enables you to access databases through JDBC where SQL queries are sent in the message body.
Deprecated:false
ProducerOnly:true
Async:false
Maven: org.apache.camel/camel-jdbc/2.18.1.redhat-000035

The jdbc component enables you to access databases through JDBC, where SQL queries are sent in the message body.

Name Kind Group Required Default Type Enum Description
dataSourceName path producer true java.lang.String Name of DataSource to lookup in the Registry.
bridgeErrorHandler parameter consumer boolean Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN/ERROR level and ignored.
exceptionHandler parameter consumer (advanced) org.apache.camel.spi.ExceptionHandler To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this options is not in use. By default the consumer will deal with exceptions, that will be logged at WARN/ERROR level and ignored.
exchangePattern parameter consumer (advanced) org.apache.camel.ExchangePattern InOnly
RobustInOnly
InOut
InOptionalOut
OutOnly
RobustOutOnly
OutIn
OutOptionalIn
Sets the exchange pattern when the consumer creates an exchange.
allowNamedParameters parameter producer true boolean Whether to allow using named parameters in the queries.
beanRowMapper parameter producer org.apache.camel.component.jdbc.BeanRowMapper To use a custom org.apache.camel.component.jdbc.BeanRowMapper when using outputClass. The default implementation will lower case the row names and skip underscores, and dashes. For example "CUST_ID" is mapped as "custId".
outputClass parameter producer java.lang.String Specify the full package and class name to use as conversion when outputType=SelectOne or SelectList.
outputType parameter producer SelectList org.apache.camel.component.jdbc.JdbcOutputType SelectOne
SelectList
StreamList
Determines the output the producer should use.
parameters parameter producer java.util.Map Optional parameters to the {@link java.sql.Statement}.

For example to set maxRows, fetchSize etc. @param parameters parameters which will be set using reflection

prepareStatementStrategy parameter producer org.apache.camel.component.jdbc.JdbcPrepareStatementStrategy Allows to plugin to use a custom org.apache.camel.component.jdbc.JdbcPrepareStatementStrategy to control preparation of the query and prepared statement.
readSize parameter producer int The default maximum number of rows that can be read by a polling query. The default value is 0.
resetAutoCommit parameter producer true boolean 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. When used with XA transactions you most likely need to set it to false so that the transaction manager is in charge of committing this tx.
transacted parameter producer boolean Whether transactions are in use.
useGetBytesForBlob parameter producer boolean To read BLOB columns as bytes instead of string data.

This may be needed for certain databases such as Oracle where you must read BLOB columns as bytes.

useHeadersAsParameters parameter producer boolean Set this option to true to use the prepareStatementStrategy with named parameters. This allows to define queries with named placeholders, and use headers with the dynamic values for the query placeholders.
useJDBC4ColumnNameAndLabelSemantics parameter producer true boolean Sets whether to use JDBC 4 or JDBC 3.0 or older semantic when retrieving column name.

JDBC 4.0 uses columnLabel to get the column name where as JDBC 3.0 uses both columnName or columnLabel. Unfortunately JDBC drivers behave differently so you can use this option to work out issues around your JDBC driver if you get problem using this component

This option is default true. @param useJDBC4ColumnNameAndLabelSemantics true to use JDBC 4.0 semantics, false to use JDBC 3.0.

synchronous parameter advanced false boolean Sets whether synchronous processing should be strictly used, or Camel is allowed to use asynchronous processing (if supported).