Microsoft JDBC "ResultSet Can Not Re-Read Row Data" Error解决办法

    技术2022-05-11  48

    http://dev2dev.bea.com.cn/bbs/thread.jspa?forumID=123&threadID=27318&tstart=0 先k一下M$ 使用MS SQL Server 2000 SP3a做数据库服务器时,用Microsoft提供的JDBC驱动(2.2.0040),在查询时遇到一个SQLException:java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]ResultSet can not re-read row data for column #. 查询语句和JDBC代码都没有问题,怀疑是Microsoft驱动的BUG,google一下果然在Microsoft support站点发现了问题:http://support.microsoft.com/kb/824106 原因是如果该表存在TEXT, NTEXT, IMAGE等大型字段,对于ResultSet的字段读取必须按照从左向右读,如果你用: int a = rs.getInt(2); int b = rs.getInt(1); 则报错。 Microsoft给出的方案是不能从右往左也不能连续读2次。没办法自己改代码,严格从左向右读,结果就没有问题了。 后来用sql server 2000 sp4 + ms jdbc driver sp3测试依然有这个BUG估计Microsoft故意不肯解决这种BUG。

    最新回复(0)