Hide Forgot
Description of problem: Error occurs while executing the following Service: <sql:binding.sql name="sql1" initialDelay="1000" period="1s"> <sql:query>call avg_sal('M',?)</sql:query> <sql:dataSourceRef>java:jboss/viavarejodb2</sql:dataSourceRef> </sql:binding.sql> The Stored Procedure "call avg_sal('M',?)" works if I call from a Java Bean Implementation. Version-Release number of selected component (if applicable): Fuse SweviceWorks 6.0 ER7 How reproducible: Happens every time. Easy to reproduce. Steps to Reproduce: 1. Create a SQL Binding Service 2. Populate "query" field with a Stored Procedure call 3. Execute the project Actual results: Caused by: org.switchyard.SwitchYardException: org.apache.camel.FailedToCreateRouteException: Failed to create route V1CamelSqlBindingModel/DatabaseService@sql1#-423328149 at: >>> To[sql://call%20avg_sal('M',?)?dataSourceRef=java:jboss/viavarejodb2] <<< in route: Route[[From[timer://V1CamelSqlBindingModel/DatabaseService@s... because of Failed to resolve endpoint: sql://call%20avg_sal('M',?%29%3FdataSourceRef=java%3Ajboss%2Fviavarejodb2 due to: Property 'dataSource' is required Expected results: Receive Stored Procedure Result Set Additional info:
The org.apache.camel.component.sql.SQLProducer class is not able to differentiate from SQL select statement to a Procedure Call, and then it always creates a PreparedStatement instead of CallableStatement. In DB2 driver, the following exception is correctly raised for this situation: Caused by: com.ibm.db2.jcc.am.SqlSyntaxErrorException: DB2 SQL Error: SQLCODE=-440, SQLSTATE=42884, SQLERRMC=JTRACH.A1S002;PROCEDURE, DRIVER=4.16.53 As a fix, I would propose a new property in Camel SQL to distinguish between queries and functions/procedures calls.
Agree. If this is implemented upstream in Apache Camel, then we can pull it down in the next refresh of Camel in a future product release.
The relevant Camel RFE seems to be: https://issues.apache.org/jira/browse/CAMEL-4725
(In reply to Tadayoshi Sato from comment #5) > The relevant Camel RFE seems to be: > https://issues.apache.org/jira/browse/CAMEL-4725
No response from customer.