Using Apache Camel with Ibatis


This is a quick tutorial about the usage of the very powerful Integration tool Apache Camel with Apache Ibatis. Many thanks to Apache Camel forums and Claus Ibsen.


  • I used Java version 1.5.0_16
  • Apache Maven version 2.0.9
  • A database mysql: I used a local db “moodle”, user “moodle”, password “moodle” and a table “mdl_user” [ create table mdl_user ( id int, firstname varchar(30), lastname varchar(30), email varchar(30) ); ]


The full sample project can be download from here!


As suggested by matteo@nowar:~/workspace$ mvn archetype:create \ -DarchetypeGroupId=org.apache.camel \ -DarchetypeArtifactId=camel-router \ -DarchetypeVersion=1.4.0 \ -DgroupId=org.redaelli \ -DartifactId=demo-ibatis matteo@nowar:~/workspace$ cd demo-ibatis matteo@nowar:~/workspace$ mvn eclipse:eclipse matteo@nowar:~/workspace$ mvn install Create iBatis files

  • src/main/resources/SqlMapConfig.xml
  • src/main/resources/User.xml
  • src/main/java/org/redaelli/

Add the routes and dependences in the files

  • src/main/java/org/redaelli/
  • pom.xml (adding dependencies “camel-ibatis” e “mysql jdbc”)

And finally run the demo with matteo@nowar:~/workspace$ mvn camel:run

Enter your instance's address

More posts like this