[ 
https://issues.apache.org/jira/browse/CAMEL-14299?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16998857#comment-16998857
 ] 

Claus Ibsen commented on CAMEL-14299:
-------------------------------------

This works fine for me, cannot reproduce any issue.

{code}
    from("file:tmp-datad")
      .setHeader("val1", constant(1))
      .setHeader("val2", constant("yo"))
      .setHeader("insertSql", constant("insert into tmp (col1, col2) values 
(:#val1, :#val2)"))
      .toD("sql:${header.insertSql}?dataSource=#dataSource")
      //.to("direct:query")
    ;

    from("timer:query")
      .to("sql:select count(*) from 
tmp?outputType=SelectOne&dataSource=#dataSource")
      .to("log:result")
    ;
{code}

This logs the 0 and 1 as output when a file is created in that folder

2019-12-18 07:49:03.679  INFO 58546 --- [- timer://query] result                
                   : Exchange[ExchangePattern: InOnly, BodyType: Long, Body: 0]
2019-12-18 07:49:04.683  INFO 58546 --- [- timer://query] result                
                   : Exchange[ExchangePattern: InOnly, BodyType: Long, Body: 0]
2019-12-18 07:49:05.688  INFO 58546 --- [- timer://query] result                
                   : Exchange[ExchangePattern: InOnly, BodyType: Long, Body: 0]
2019-12-18 07:49:06.691  INFO 58546 --- [- timer://query] result                
                   : Exchange[ExchangePattern: InOnly, BodyType: Long, Body: 0]
2019-12-18 07:49:07.696  INFO 58546 --- [- timer://query] result                
                   : Exchange[ExchangePattern: InOnly, BodyType: Long, Body: 0]
2019-12-18 07:49:08.699  INFO 58546 --- [- timer://query] result                
                   : Exchange[ExchangePattern: InOnly, BodyType: Long, Body: 0]
2019-12-18 07:49:09.703  INFO 58546 --- [- timer://query] result                
                   : Exchange[ExchangePattern: InOnly, BodyType: Long, Body: 0]
2019-12-18 07:49:10.706  INFO 58546 --- [- timer://query] result                
                   : Exchange[ExchangePattern: InOnly, BodyType: Long, Body: 0]
2019-12-18 07:49:11.709  INFO 58546 --- [- timer://query] result                
                   : Exchange[ExchangePattern: InOnly, BodyType: Long, Body: 1]
2019-12-18 07:49:12.712  INFO 58546 --- [- timer://query] result                
                   : Exchange[ExchangePattern: InOnly, BodyType: Long, Body: 1]
2019-12-18 07:49:13.712  INFO 58546 --- [- timer://query] result                
                   : Exchange[ExchangePattern: InOnly, BodyType: Long, Body: 1]
2019-12-18 07:49:14.716  INFO 58546 --- [- timer://query] result                
                   : Exchange[ExchangePattern: InOnly, BodyType: Long, Body: 1]
2019-12-18 07:49:15.718  INFO 58546 --- [- timer://query] result                
                   : Exchange[ExchangePattern: InOnly, BodyType: Long, Body: 1]

> camel-sql - Dynamic producer (toD) problem
> ------------------------------------------
>
>                 Key: CAMEL-14299
>                 URL: https://issues.apache.org/jira/browse/CAMEL-14299
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-sql
>    Affects Versions: 3.0.0
>            Reporter: Gurpal2000
>            Priority: Major
>             Fix For: 3.0.1, 3.1.0
>
>         Attachments: log.txt
>
>
> Spring Boot: 2.2.1
> Camel: 3.0.0
> *Works* using "to()"
>  
> {code:java}
> from("file://d:/tmp/?fileName=test&noop=true")
> .setHeader("val1", constant(1))
> .setHeader("val2", constant("yo"))
> .to("sql:insert into gbtemp (col1, col2) values (:#val1, 
> :#val2)?dataSource=#dataSource");
> {code}
> Does *not work* using ".toD()"
> {code:java}
> from("file://d:/tmp/?fileName=test&noop=true")
> .setHeader("val1", constant(1))
> .setHeader("val2", constant("yo"))
> .setHeader("insertSql", constant("insert into gbtemp (col1, col2) values 
> (:#val1, :#val2)"))
> .toD("sql:${header.insertSql}?dataSource=#dataSource");
> {code}
> This used to work fine under Camel 2.x
> Example error lines:
> {code:java}
> Caused by: org.apache.camel.RuntimeCamelException: Cannot auto create 
> component: sql
> Caused by: org.apache.camel.PropertyBindingException: Error binding 
> properties on bean: org.apache.camel.component.sql.SqlComponent@a72b3b2
> org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: 
> sql://insert...
> {code}
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to