2 Replies Latest reply on May 31, 2012 1:20 PM by lobo369

    ESB CAMEL SQL

    lobo369

      I need to generate e dynamic query with parameters from a CSV file.

       

      I'm using FuseSource ESB 4.4.1-fuse-03-06.

       

       

       

       

      My problem is that SQL component no detect the Arraylist body and throw an exception with invalid column type.

       

      If I only set one parameter as body and only one parameter in que query I don't have any problem but how I can define a list of parameters.

       

       

      Into ProcessTransaccion bean I have the next code:

       

      List l= new ArrayList();

                 

      l.add(p1);

      l.add(p2);

      l.add(p3);

      l.add(p4);

       

      in.setHeader("CamelSqlQuery", query);          

      in.setBody((List)l);

       

      Somebody have an example to set list of parameters into de body ?

       

      Thanks in advanced.

       

      Edited by: lalosam369 on May 2, 2012 10:44 PM

        • 1. Re: ESB CAMEL SQL
          davsclaus

          Your query, select * from dual, do not have any query parameters. And therefore the message body is not used.

           

          The code will convert the message body to an iterator, which for a List type will walk each element in the list.

           

              Iterator<?> iterator = exchange.getIn().getBody(Iterator.class);

          • 2. Re: ESB CAMEL SQL
            lobo369

            Thank You for your answer davsclaus.

             

            The problem wasn't the query, because as I said above, It is set into the "process" overrriding the configuration of the route.

             

            The problem was with "date" parameters. I had to change "date objects" by Strings.