Sybase报Invalid packet type 0x22错误

1 篇文章 0 订阅
1 篇文章 0 订阅

今天使用Sybase(15.7 Developer版)查询DB时,遇到了很诡异的错误,错误异常如下:

<-- java.sql.SQLException: TDS Protocol error: Invalid packet type 0x22
	at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2284)
	at net.sourceforge.jtds.jdbc.TdsCore.isDataInResultSet(TdsCore.java:792)
	at net.sourceforge.jtds.jdbc.JtdsResultSet.<init>(JtdsResultSet.java:146)
	at net.sourceforge.jtds.jdbc.JtdsStatement.executeSQLQuery(JtdsStatement.java:424)
	at net.sourceforge.jtds.jdbc.JtdsPreparedStatement.executeQuery(JtdsPreparedStatement.java:693)
	at com.trs.infra.persistent.BaseObjs.loadCurrentData(BaseObjs.java:1321)
	at com.trs.infra.persistent.BaseObjs.open(BaseObjs.java:1437)
	at com.trs.ekp.stat.obtain.StatResultObtainMgr.queryStatResults(StatResultObtainMgr.java:194)
	at com.trs.ekp.stat.domain.ExpertLevelMgrTest.testGetAllExpertLevels(ExpertLevelMgrTest.java:51)
	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 junit.framework.TestCase.runTest(TestCase.java:154)
	at junit.framework.TestCase.runBare(TestCase.java:127)
	at junit.framework.TestResult$1.protect(TestResult.java:106)
	at junit.framework.TestResult.runProtected(TestResult.java:124)
	at junit.framework.TestResult.run(TestResult.java:109)
	at junit.framework.TestCase.run(TestCase.java:118)
	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: net.sourceforge.jtds.jdbc.ProtocolException: Invalid packet type 0x22
	at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2271)
	... 24 more

 

经过定位,最终发现是指定的表中的字段个数太多(我这个表中有575个字段),把sql语句修改成select 字段1,字段2 …… from 表

问题不再重现。

select * 时,底层虽然也会提取所有字段,但是会报这个错误,如果我们把所有字段列在select后面,则不会报错,可以正确提取出字段。sql语句变为:select Field1,Field2,Feild3…… from TableName.

后来又测试了下,发现对如果是对decimal字段类型进行排序时,也会报这个错。

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值