camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nathan Wray (JIRA)" <>
Subject [jira] [Updated] (CAMEL-7803) DefaultJdbcPrepareStatementStrategy Iterator fails on null value inserts
Date Thu, 11 Sep 2014 13:17:33 GMT


Nathan Wray updated CAMEL-7803:
    Attachment: 7803-patch.txt

Patch added new boolean flag "preFetched" that replaces the (next==null) test.  this allows
names with null values to succeed.

> DefaultJdbcPrepareStatementStrategy Iterator fails on null value inserts
> ------------------------------------------------------------------------
>                 Key: CAMEL-7803
>                 URL:
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-jdbc
>    Affects Versions: 2.13.2
>            Reporter: Nathan Wray
>         Attachments: 7803-patch.txt
> The iterator returned by createPopulateIterator in DefaultJdbcPrepareStatementStrategy
reports "hasNext() == false" when it encounters a map value of null.  This happens when using
the map header JDBC_PARAMETERS = "CamelJdbcParameters" to insert null values with a prepared
statement.  The Iterator ends prematurely when it reaches a parameter name with a null value.
> For example, passing in a map where the 3rd parameter of 19 has a value of null causes
the following exception to be thrown:
> java.sql.SQLException: Number of parameters mismatch. Expected: 19, was:2
>         at org.apache.camel.component.jdbc.DefaultJdbcPrepareStatementStrategy.populateStatement(
>         at org.apache.camel.component.jdbc.JdbcProducer.doCreateAndExecuteSqlStatementWithHeaders(
>         at org.apache.camel.component.jdbc.JdbcProducer.createAndExecuteSqlStatement(
>         at org.apache.camel.component.jdbc.JdbcProducer.processingSqlBySettingAutoCommit(

This message was sent by Atlassian JIRA

View raw message