Camel
  1. Camel
  2. CAMEL-3096

Create a simple example for JDBC - camel-example-jdbc

    Details

    • Type: New Feature New Feature
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.12.0
    • Component/s: examples
    • Labels:
      None

      Description

      A simple JDBC example using camel-jdbc (Spring JdbcTemplate) which is a really good JdbcTemplate.

      And show how to deply and run it in OSGi.

      The other database examples is based on jpa crapola which is complex and overkill for most people. So having an easy to understand and use example would be great.
      We can use an in memory database such as HSQLDB.

      1. CAMEL-3096.patch
        25 kB
        Zemian Deng
      2. CAMEL-3096_v2.patch
        25 kB
        Zemian Deng

        Activity

        Claus Ibsen created issue -
        Claus Ibsen made changes -
        Field Original Value New Value
        Fix Version/s 2.5.0 [ 12320 ]
        Fix Version/s Future [ 11977 ]
        Claus Ibsen made changes -
        Assignee Claus Ibsen [ davsclaus ]
        Jeff Turner made changes -
        Project Import Sat Nov 27 00:14:50 EST 2010 [ 1290834890113 ]
        Hide
        Alan Foster added a comment - - edited

        The other database examples is based on jpa crapola which is complex and overkill for most people

        Where is the link for this?

        Show
        Alan Foster added a comment - - edited The other database examples is based on jpa crapola which is complex and overkill for most people Where is the link for this?
        Hide
        Babak Vahdat added a comment -

        It's here:
        http://camel.apache.org/etl-example.html

        Also note that as in the meanwhile we make use of Apache Derby for the Camel's own unit-tests (see CAMEL-4734) and as you will provide unit-tests for the example itself, IMHO it would be better to make use of Derby instead of HSQLDB. Though not really sure what Claus thinks about this.

        Show
        Babak Vahdat added a comment - It's here: http://camel.apache.org/etl-example.html Also note that as in the meanwhile we make use of Apache Derby for the Camel's own unit-tests (see CAMEL-4734 ) and as you will provide unit-tests for the example itself, IMHO it would be better to make use of Derby instead of HSQLDB. Though not really sure what Claus thinks about this.
        Hide
        Christian Müller added a comment -

        If there is no reason not to use Derby, than this example should also use Derby.

        Show
        Christian Müller added a comment - If there is no reason not to use Derby, than this example should also use Derby.
        Hide
        Claus Ibsen added a comment -

        Yeah its fine to use Derby, just that we need a database that is in memory and easy to setup and use. In the older days we preferred using HSQLDB. But I guess in recent time we have aligned to use Derby in testing/examples etc.

        Show
        Claus Ibsen added a comment - Yeah its fine to use Derby, just that we need a database that is in memory and easy to setup and use. In the older days we preferred using HSQLDB. But I guess in recent time we have aligned to use Derby in testing/examples etc.
        Hide
        Alan Foster added a comment -

        Can I just clarify whether this example should be using the 'camel-jdbc' component?
        Or if you are after an example which uses camel + jdbc spring templates? IE inject the datasource into a bean, instantiate a jdbc template and use a route which sends the exchange to the bean?
        Could you let me know if you are after the first or second scenario please

        Alan

        Show
        Alan Foster added a comment - Can I just clarify whether this example should be using the 'camel-jdbc' component? Or if you are after an example which uses camel + jdbc spring templates? IE inject the datasource into a bean, instantiate a jdbc template and use a route which sends the exchange to the bean? Could you let me know if you are after the first or second scenario please Alan
        Hide
        Claus Ibsen added a comment -

        Alan, I think its up to you what you consider a simple example.

        The camel-jdbc is very simple as you don't need to write code. Though its also a bit limited, and when you need a bit more, then maybe a bean using spring jdbc template is also a simple solution (for people okay with writing a bit of code).

        The camel-sql is a bit special IMHO as you have the query in the uri, which maybe is not so nice for bigger queries. Though you can set the SQL query as a header as well. I think camel-sql uses prepared statements so maybe its overall better.

        Show
        Claus Ibsen added a comment - Alan, I think its up to you what you consider a simple example. The camel-jdbc is very simple as you don't need to write code. Though its also a bit limited, and when you need a bit more, then maybe a bean using spring jdbc template is also a simple solution (for people okay with writing a bit of code). The camel-sql is a bit special IMHO as you have the query in the uri, which maybe is not so nice for bigger queries. Though you can set the SQL query as a header as well. I think camel-sql uses prepared statements so maybe its overall better.
        Hide
        Christian Müller added a comment -

        Yeah, choose what ever you want to show and it's not already covered in our examples.
        Make sure you focus on one thing (or may be two if you want to show camel-jdbc and camel-sql in one example).

        Show
        Christian Müller added a comment - Yeah, choose what ever you want to show and it's not already covered in our examples. Make sure you focus on one thing (or may be two if you want to show camel-jdbc and camel-sql in one example).
        Hide
        Zemian Deng added a comment -

        Hi, I have few examples usage on camel-jdbc and I would be happy to contrite to the project.

        BTW, is DERBY a must? My samples are all using H2. The H2 comes with a web console that's very productive to verify and query data during testing. If not, then I have to reconfigure it to use DERBY.

        Show
        Zemian Deng added a comment - Hi, I have few examples usage on camel-jdbc and I would be happy to contrite to the project. BTW, is DERBY a must? My samples are all using H2. The H2 comes with a web console that's very productive to verify and query data during testing. If not, then I have to reconfigure it to use DERBY.
        Hide
        Zemian Deng added a comment -

        Here is a patch that contains my example files. See README.txt for usage.

        Show
        Zemian Deng added a comment - Here is a patch that contains my example files. See README.txt for usage.
        Zemian Deng made changes -
        Attachment CAMEL-3096.patch [ 12598644 ]
        Hide
        Christian Müller added a comment -

        It would be good, if you could update the example to use Derby. In this case it's easier for us to support the examples and we do not have to maintain an additional dependency.

        Show
        Christian Müller added a comment - It would be good, if you could update the example to use Derby. In this case it's easier for us to support the examples and we do not have to maintain an additional dependency.
        Hide
        Zemian Deng added a comment -

        Sure, see CAMEL-3096_v2.patch - uses DERBY DB instead.

        Show
        Zemian Deng added a comment - Sure, see CAMEL-3096 _v2.patch - uses DERBY DB instead.
        Zemian Deng made changes -
        Attachment CAMEL-3096_v2.patch [ 12598665 ]
        Hide
        Bilgin Ibryam added a comment -

        FYI I added restlet-jdbc example based on https://github.com/bibryam/camel-example-restlet-jdbc

        Show
        Bilgin Ibryam added a comment - FYI I added restlet-jdbc example based on https://github.com/bibryam/camel-example-restlet-jdbc
        Claus Ibsen made changes -
        Fix Version/s 2.12.0 [ 12323968 ]
        Fix Version/s Future [ 12315692 ]
        Claus Ibsen made changes -
        Assignee Claus Ibsen [ davsclaus ]
        Hide
        Claus Ibsen added a comment -

        Thanks for the contribution.

        Show
        Claus Ibsen added a comment - Thanks for the contribution.
        Claus Ibsen made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Resolved Resolved
        1085d 5h 29m 1 Claus Ibsen 21/Aug/13 14:32

          People

          • Assignee:
            Claus Ibsen
            Reporter:
            Claus Ibsen
          • Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development