Announcement Announcement Module
Collapse
No announcement yet.
TYPES.null error with Spring/MS SQL server jdbc driver configuration Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • TYPES.null error with Spring/MS SQL server jdbc driver configuration

    When setNull() is called with second parameter Types.NULL, it causes a null pointer exception in the MS JDBC driver. Configuration: SQL server 2005 SP2, MS JDBC driver 1.1, Spring 1.2.8. This is used as setNull(paramIndex, Types.NULL) in the class org.springframework.jdbc.core.StatementCreatorUtil s; also please see: http://forums.microsoft.com/MSDN/Sho...67342&SiteID=1 for details.

    Stack trace below:
    java.lang.NullPointerException

    at com.microsoft.sqlserver.jdbc.AppDTVImpl$SetValueOp .executeDefault(Unknown Source)
    at com.microsoft.sqlserver.jdbc.DTV.executeOp(Unknown Source)
    at com.microsoft.sqlserver.jdbc.AppDTVImpl.setValue(U nknown Source)
    at com.microsoft.sqlserver.jdbc.DTV.setValue(Unknown Source)
    at com.microsoft.sqlserver.jdbc.Parameter.setValue(Un known Source)
    at com.microsoft.sqlserver.jdbc.Parameter.setValue(Un known Source)
    at com.microsoft.sqlserver.jdbc.SQLServerPreparedStat ement.setNull(Unknown Source)
    at org.apache.commons.dbcp.DelegatingPreparedStatemen t.setNull(DelegatingPreparedStatement.java:104)
    at org.springframework.jdbc.core.StatementCreatorUtil s.setParameterValue(StatementCreatorUtils.java:96)
    at org.springframework.jdbc.core.JdbcTemplate$ArgPrep aredStatementSetter.setValues(JdbcTemplate.java:11 81)
    at org.springframework.jdbc.core.JdbcTemplate$2.doInP reparedStatement(JdbcTemplate.java:695)
    at org.springframework.jdbc.core.JdbcTemplate.execute (JdbcTemplate.java:476)
    at org.springframework.jdbc.core.JdbcTemplate.update( JdbcTemplate.java:691)
    at org.springframework.jdbc.core.JdbcTemplate.update( JdbcTemplate.java:753)
    at org.springframework.jdbc.core.JdbcTemplate.update( JdbcTemplate.java:761)

    Any workarounds for this?

    Thanks,
    sm.

  • #2
    Have you tried explicitly providing an array of the java.sql.Type for each parameter using the "int update(String sql, Object[] args, int[] argTypes)" method?

    Comment


    • #3
      That worked, thanks.

      Comment


      • #4
        Originally posted by sm_springframework View Post
        That worked, thanks.
        Spring 2.0.6 has the same issue and the same solution works. Thank you for your help, Thomas!

        Unfortunately, this means that you can't use the "new" SimpleJdbcTemplate for updates if you depend on the recent MS JDBC-Driver 1.1.

        jiai

        Comment


        • #5
          You could always give jTDS a try instead of the MS driver, this might behave differently.
          Last edited by karldmoore; Aug 29th, 2007, 11:26 AM.

          Comment


          • #6
            Originally posted by karldmoore View Post
            You could always give jTDS a try instead of the MS driver, this might behave differently.
            jTDS behaves differently (and works) - as "sm" describes in his post on the Microsoft forum.
            Unfortunately, jTDS doesn't support connection pooling as denoted in the FAQ.

            jiai

            Comment


            • #7
              Originally posted by jiai View Post
              jTDS behaves differently (and works) - as "sm" describes in his post on the Microsoft forum.
              Ok that will teach me for not reading that .

              Originally posted by jiai View Post
              Unfortunately, jTDS doesn't support connection pooling as denoted in the FAQ.
              Can't you just use DBCP or c3p0 to provide this instead?
              Last edited by karldmoore; Aug 29th, 2007, 11:26 AM.

              Comment

              Working...
              X