This happens when 2 ResultSets on the same connection are being iterated at the same time. Setting useCursors=true fixes the problem, but we don't want the performance penalty of server side cursors.
Below is the exception, but even more disturbing is that even when the exception is not generated, bad data is sometimes returned!
java.sql.SQLException: TDS Protocol error: Invalid packet type 0xc9
at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2316)
at net.sourceforge.jtds.jdbc.TdsCore.getNextRow(TdsCore.java:764)
at net.sourceforge.jtds.jdbc.JtdsResultSet.next(JtdsResultSet.java:593)
at com.knoa.commons.sql.SQLHelper.diff(SQLHelper.java:397)
at com.knoa.commons.sql.SQLHelper.diff(SQLHelper.java:362)
at com.knoa.validation.AnalysisSanity.diff(AnalysisSanity.java:298)
at com.knoa.validation.AnalysisSanity.diffRdtError(AnalysisSanity.java:341)
at com.knoa.test.ServerTest.rdtError(ServerTest.java:769)
at com.knoa.analysis.service.agg.RelabelServiceTest.rdtError(RelabelServiceTest.java:111)
Caused by: net.sourceforge.jtds.jdbc.ProtocolException: Invalid packet type 0xc9
at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2303)
... 30 more
... Removed 22 stack frames
Logged In: YES
user_id=479629
Originator: YES
Also, due to http://sourceforge.net/tracker/index.php?func=detail&aid=1812686&group_id=33291&atid=407762
we cannot set useCursors=true
Thank you for reporting that issue. I created a simple test (see below) but was not able to reproduce the problem here. Does this test work in your setup? Could you provide further details or adapt the test to show the error?
I run the test against the current jTDS 2.0 code base and that indeed caused errors. I still haven't seen the "Invalid packet type 0xc9" message but the results are mixed up (maybe that's what you called "bad data") between the different threads. Are you using a jTDS version compiled from CVS?
Please forget my last question, the stacktrace is answer enough...
I assigned the bug to jTDS v2. If anyone is able to reproduce the problem with jTDS 1.2.2, please drop me a line.
I'm closing this bug due to jTDS 2.0 being too far from production ready. We have a unit test showing this problem and version 2 will not make it into a release before all tests succeed, anyway.
Cheers,
momo