Bug 1044786 - Error when calling DB2 9.7 Stored Procedure on SQL Binding
Summary: Error when calling DB2 9.7 Stored Procedure on SQL Binding
Keywords:
Status: NEW
Alias: None
Product: JBoss Fuse Service Works 6
Classification: JBoss
Component: Camel, SwitchYard
Version: 6.0.0
Hardware: Unspecified
OS: Linux
unspecified
medium
Target Milestone: ---
: ---
Assignee: Nobody
QA Contact: Matej Melko
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-12-19 02:14 UTC by Thiago Araki
Modified: 2021-11-08 10:23 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
The org.apache.camel.component.sql.SQLProducer class is not able to differentiate an SQL select statement from a procedure call, and then it always creates a PreparedStatement instead of CallableStatement. If you are using DB2, this results in an org.switchyard.SwitchYardException.
Clone Of:
Environment:
Last Closed:
Type: Bug


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker SWITCHYARD-1925 0 Major Open Add stored procedure support for SQL Gateway Binding 2016-05-05 20:22:20 UTC

Description Thiago Araki 2013-12-19 02:14:49 UTC
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:

Comment 2 Thiago Araki 2013-12-19 03:44:13 UTC
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.

Comment 4 Keith Babo 2013-12-20 00:35:00 UTC
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.

Comment 5 Tadayoshi Sato 2014-01-10 01:56:22 UTC
The relevant Camel RFE seems to be: https://issues.apache.org/jira/browse/CAMEL-4725

Comment 6 Aaron Cirillo 2014-06-26 19:19:20 UTC
(In reply to Tadayoshi Sato from comment #5)
> The relevant Camel RFE seems to be:
> https://issues.apache.org/jira/browse/CAMEL-4725

Comment 8 Aileen 2015-02-16 16:56:01 UTC
No response from customer.


Note You need to log in before you can comment on or make changes to this bug.