You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2014/09/11 17:58:34 UTC

[jira] [Commented] (CAMEL-7803) DefaultJdbcPrepareStatementStrategy Iterator fails on null value inserts

    [ https://issues.apache.org/jira/browse/CAMEL-7803?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14130177#comment-14130177 ] 

ASF GitHub Bot commented on CAMEL-7803:
---------------------------------------

GitHub user nathanwray opened a pull request:

    https://github.com/apache/camel/pull/265

    CAMEL-7803

     Patch added new boolean flag "preFetched" to allow inserts with parameters that have null values

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/nathanwray/camel patch-1

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/camel/pull/265.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #265
    
----
commit 693fea2b3cee7be931b4bcfd92726e75f782adf9
Author: nathanwray <na...@users.noreply.github.com>
Date:   2014-09-11T15:57:09Z

    CAMEL-7803
    
     Patch added new boolean flag "preFetched" to allow inserts with parameters that have null values

----


> DefaultJdbcPrepareStatementStrategy Iterator fails on null value 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
>         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(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)