从Oracle向SQL Server中间库交换数据的时候,出现了异常 com.microsoft.sqlserver.jdbc.SQLServerException: 将截断字符串或二进制数据 具体异常信息如下: Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: 将截断字符串或二进制数据。 at com
从Oracle向SQL Server中间库交换数据的时候,出现了异常
com.microsoft.sqlserver.jdbc.SQLServerException: 将截断字符串或二进制数据
具体异常信息如下:
Caused by:
com.microsoft.sqlserver.jdbc.SQLServerException: 将截断字符串或二进制数据。
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:216)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1515)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:404)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:350)
at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:5696)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1715)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:180)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:155)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeUpdate(SQLServerPreparedStatement.java:314)
at com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement.pmiExecuteUpdate(WSJdbcPreparedStatement.java:1104)
at com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement.executeUpdate(WSJdbcPreparedStatement.java:771)
... 11 more
在网上搜罗了一下,大概有几种原因会导致此异常
http://www.cnblogs.com/lingy/archive/2012/09/14/2684491.html
字段长度不够
http://bbs.csdn.net/topics/330076495
有trigger处理业务逻辑
这次遇到的就是字段长度不够的问题,SQL Server中定义的长度为24,而Oracle中定义的长度为50,修改字段长度,问题解决
判断长度相关SQL语句如下:以字符串“某餐证字20112101230000159”为例
SQL Server中查询的SQL语句
select len('某餐证字20112101230000159'),datalength('某餐证字20112101230000159');
长度为21,占用25个字节
Oracle中查询的SQL语句
select length('某餐证字20112101230000159'), lengthb('某餐证字20112101230000159') from dual;
长度为21,占用25个字节
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn