Results 1 to 2 of 2

Thread: jdbc inbound-channel-adapter update statement not being translated correctly...

  1. #1
    Join Date
    Nov 2009
    Location
    Montreal, Quebec
    Posts
    398

    Unhappy jdbc inbound-channel-adapter update statement not being translated correctly...

    I have a JDBC inbound channel adapter defined as the following. For some reason, suddenly it's not working anymore and I'm getting the exception below which seems to show that the update statement is convering the "cqtime = :cqtime" to "cqtime = ?, ?, ?"...

    Code:
        <int-jdbc:inbound-channel-adapter
                query="select * from dsnlogdata.crcpq where cqsts=''"
                channel="reportCardRequestChannel"
                data-source="dataSource"
                update="update dsnlogdata.crcpq set cqsts='F' where cqtime = :cqtime">
            <int:poller fixed-rate="60000">
                <int:transactional />
            </int:poller>    
        </int-jdbc:inbound-channel-adapter>
    Code:
    19:17:32.742 [task-scheduler-5] ERROR o.s.i.handler.LoggingHandler - org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar [update dsnlogdata.crcpq set cqsts='F' where cqtime = ?, ?, ?]; nested exception is java.sql.SQLException: [SQL0104] Token , was not valid. Valid tokens: OR SKIP WITH.
    This worked fine until I today. All I've done today is modify some code in a completely separate module, unrelated to this JDBC inbound channel adapter. I'm using Spring Integration 2.2.0.RELEASE.

  2. #2
    Join Date
    Nov 2009
    Location
    Montreal, Quebec
    Posts
    398

    Default

    Well chalk this up to RTFM :P

    After re-reading the documentation, I realized my problem. In my update statement where "cqtime = :cqtime", this worked fine up until now because the select query on the inbound channel adapter was mainly returning 1 record. In my test tonight, I was retrieving 3 records at the same time, hence the "cqtime = ?, ?, ?". Each of those ? value markers was for each one of the records returned by the select query. Changing it to "cqtime in (:cqtime)" fixed my problem. Now regardless of how many records is returned by the select statement, they'll all be updated properly.

    http://static.springsource.org/sprin...hannel-adapter

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •