Uploaded image for project: 'iBatis for Java [READ ONLY]'
  1. iBatis for Java [READ ONLY]
  2. IBATIS-536

Errors when using PreparedStatement.setNull(i,Types.OTHER) on some RDBMS

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.3.3
    • 2.3.5
    • None
    • None
    • Apache Derby Embedded
      Informix
      Microsoft SQL Server
      DB2
      jConnect
      SQLServer

    Description

      Firstly, i encountered an error with Derby (the same kind as described below):
      http://markmail.org/message/ayosubiuw7cp7sdl

      A workaround is to explicitly specify the JDBC type in the mapping but this is irritating .

      And after searching, i found the same problems with Spring JdbcTemplate:
      http://jira.springframework.org/browse/SPR-1234
      http://jira.springframework.org/browse/SPR-2407
      http://jira.springframework.org/browse/SPR-4465
      http://jira.springframework.org/browse/SPR-4809

      There are i think two reasons for these errors:

      • using PrepareStatement.setNull(int, Types.OTHER) for any column type is not supported by all RDMS
      • by default the jdbcType field ParameterMapping is set to 0 which is not a standard value for Types.* and is different than JdbcTypeRegistry.UNKNOWN_TYPE so most of the time the call is setNull(i, 0)

      Attachments

        1. IBATIS-536-ps-setNull-2008-09-16-2.patch
          6 kB
          Sébastien Launay
        2. IBATIS-536-ps-setNull-2008-09-16.patch
          6 kB
          Sébastien Launay
        3. IBATIS-536-ps-setNull-2008-09-15.patch
          5 kB
          Sébastien Launay

        Activity

          People

            kaig Kai Grabfelder
            yabon Sébastien Launay
            Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: