Since we're on a major migration process of this website, some component documents here are out of sync right now. In the meantime you may want to look at the early version of the new website
https://camel.apache.org/staging/
We would very much like to receive any feedback on the new site, please join the discussion on the Camel user mailing list.
SQL LanguageThe SQL support is added by JoSQL and is primarily used for performing SQL queries on in-memory objects. If you prefer to perform actual database queries then check out the JPA component. Looking for the SQL component Camel has both a SQL language and a SQL Component. This page is about the SQL language. Click on SQL Component if you are looking for the component instead. To use SQL in your camel routes you need to add the a dependency on camel-josql which implements the SQL language. If you use maven you could just add the following to your pom.xml, substituting the version number for the latest & greatest release (see the download page for the latest versions). <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-josql</artifactId> <version>x.x.x</version> <!-- use the same version as your Camel core version --> </dependency> Camel supports SQL to allow an Expression or Predicate to be used in the DSL or Xml Configuration. For example you could use SQL to create an Predicate in a Message Filter or as an Expression for a Recipient List. from("queue:foo").setBody().sql("select * from MyType").to("queue:bar") And the spring DSL: <from uri="queue:foo"/> <setBody> <sql>select * from MyType</sql> </setBody> <to uri="queue:bar"/> Variables
Loading script from external resourceAvailable as of Camel 2.11 You can externalize the script and have Camel load it from a resource such as .setHeader("myHeader").sql("resource:classpath:mysql.sql") |