Nathan Wray created CAMEL-7803:
----------------------------------

             Summary: DefaultJdbcPrepareStatementStrategy Iterator fails on 
null valuer inserts
                 Key: CAMEL-7803
                 URL: https://issues.apache.org/jira/browse/CAMEL-7803
             Project: Camel
          Issue Type: Bug
          Components: camel-jdbc
    Affects Versions: 2.13.2
            Reporter: Nathan Wray


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(DefaultJdbcPrepareStatementStrategy.java:137)
        at 
org.apache.camel.component.jdbc.JdbcProducer.doCreateAndExecuteSqlStatementWithHeaders(JdbcProducer.java:133)
        at 
org.apache.camel.component.jdbc.JdbcProducer.createAndExecuteSqlStatement(JdbcProducer.java:116)
        at 
org.apache.camel.component.jdbc.JdbcProducer.processingSqlBySettingAutoCommit(JdbcProducer.java:85)







--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to