Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-18797

camel-sql - Conditionally execute ps.getParameterMetaData() in SqlProducer populateStatement

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 3.14.6, 3.18.4, 3.19.0
    • 3.14.7, 3.18.5, 3.20.0
    • camel-sql
    • None
    • Windows 10

      Karaf 4.4.2

      OpenJDK 64-Bit Server VM version 11.0.13+8

      Camel 3.18.4

    • Patch Available
    • Unknown

    Description

      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

      select 'x' from TABLEA A 
         JOIN TABLEB B on A.F1 = B.F1 and B.F2 = :#parm1 
      WHERE A.F1 = :#parm2
      

      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.

       

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            davsclaus Claus Ibsen
            jtt77777@gmail.com John Taylor
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment