Spring 2.5.6 + 2.3.4.726 + Sybase ASE 15.5 환경에서 아래와 같은 에러가 발생했다면 데이터에 null이 들어있고 해당 값에 대한 적절한 JDBC Type을 찾지 못해서 발생하는 예외이다.
Caused by: com.sybase.jdbc3.jdbc.SybSQLException: A wrong datastream has been sent to the server. The server was expecting token 32 but got the token 33. This is an internal error.
at com.sybase.jdbc3.tds.Tds.a(Unknown Source)
at com.sybase.jdbc3.tds.Tds.nextResult(Unknown Source)
at com.sybase.jdbc3.jdbc.ResultGetter.nextResult(Unknown Source)
at com.sybase.jdbc3.jdbc.SybStatement.nextResult(Unknown Source)
at com.sybase.jdbc3.jdbc.SybStatement.nextResult(Unknown Source)
at com.sybase.jdbc3.jdbc.SybStatement.queryLoop(Unknown Source)
at com.sybase.jdbc3.jdbc.SybStatement.executeQuery(Unknown Source)
at com.sybase.jdbc3.jdbc.SybPreparedStatement.executeQuery(Unknown Source)
at com.sybase.jdbc3.jdbc.SybDatabaseMetaData.a(Unknown Source)
at com.sybase.jdbc3.jdbc.SybDatabaseMetaData.getDatabaseProductName(Unknown Source)
at org.apache.commons.dbcp.DelegatingDatabaseMetaData.getDatabaseProductName(DelegatingDatabaseMetaData.java:259)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.jdbc.support.JdbcUtils$1.processMetaData(JdbcUtils.java:325)
at org.springframework.jdbc.support.JdbcUtils.extractDatabaseMetaData(JdbcUtils.java:290)
... 34 more
이 문제를 해결하기 위해서는 다음과 같이 해당 타입에 대한 jdbcType 과 nullValue="NO_ENTRY"와 같이 NULL을 허용하겠다는 것을 명시해야만 한다.
<parameterMap id="UnicodeData-param" class="UnicodeData">
<parameter property="authorCode" jdbcType="CHAR" />
<parameter property="authorName" jdbcType="VARCHAR" />
<parameter property="authorNameUni" jdbcType="UNIVARCHAR" />
<parameter property="authorEnglishName" jdbcType="VARCHAR" nullValue="NO_ENTRY" />
<parameter property="authorAnotherName" jdbcType="VARCHAR" nullValue="NO_ENTRY" />
<parameter property="authorAnotherNameUni" jdbcType="UNIVARCHAR" nullValue="NO_ENTRY" />
</parameterMap>