You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (Jira)" <ji...@apache.org> on 2022/12/09 06:13:00 UTC

[jira] [Resolved] (CAMEL-18797) camel-sql - Conditionally execute ps.getParameterMetaData() in SqlProducer populateStatement

     [ https://issues.apache.org/jira/browse/CAMEL-18797?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen resolved CAMEL-18797.
---------------------------------
      Assignee: Claus Ibsen
    Resolution: Fixed

Thanks for reporting and providing a patch

> camel-sql - Conditionally execute ps.getParameterMetaData() in SqlProducer populateStatement
> --------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-18797
>                 URL: https://issues.apache.org/jira/browse/CAMEL-18797
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-sql
>    Affects Versions: 3.14.6, 3.18.4, 3.19.0
>         Environment: Windows 10
> Karaf 4.4.2
> OpenJDK 64-Bit Server VM version 11.0.13+8
> Camel 3.18.4
>            Reporter: John Taylor
>            Assignee: Claus Ibsen
>            Priority: Minor
>             Fix For: 3.14.7, 3.18.5, 3.20.0
>
>         Attachments: patchfile.txt
>
>
> I have a similar problem to the problem described in CAMEL-18399 but instead of the result of getParameterMetadata returning null it is throwing an exception from the driver. The driver is com.microsoft.sqlserver/mssql-jdbc/11.2.1.jre11 although all version are affected as far as I can tell. It looks like a bug in their parser where it fails to parse for valid queries when there are parameters. Where it affects me the most is when sql-92 join syntax includes a parameter, like
> {code:sql}
> select 'x' from TABLEA A 
>    JOIN TABLEB B on A.F1 = B.F1 and B.F2 = :#parm1 
> WHERE A.F1 = :#parm2
> {code}
> Including the parametersCount option doesn't help in this case as it doesn't bypass the getParameterMetadata. My proposal is to only call getParameterMetadata  if the parametersCount isn't set because it is only being used to populate the expected variable anyway.
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)