Skip to Content.
Sympa Menu

freetds - Re: JDBC: what kind of MSSQL errors are caught?

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Stefan Bodewig <bodewig AT bost.de>
  • To: <freetds AT franklin.oit.unc.edu>
  • Cc: jtds-developer AT lists.sourceforge.net
  • Subject: Re: JDBC: what kind of MSSQL errors are caught?
  • Date: 19 Nov 2001 13:15:06 +0100

Sorry for the cross-posting, but this fixes a problem that has been
reported to the FreeTDS mailing list while the jtds list is the
correct place for the patch.

On Thu, 15 Nov 2001, Andreas Schörk <andreas.schoerk AT infor.de> wrote:

>> From: Stefan Bodewig [mailto:bodewig AT bost.de]
>>
>> What is your preferred patch submission policy?
>
> there aren´t submitted many patches yet.

So here we go 8-)

The appended patch will reinstate the error checking in
Tds.submitProcedure. There are quite a few other places where error
packets are discarded in Tds (just search for okay = false), and
somebody should be dealing with it, but this fixes the problem that
has been reported to the FreeTDS list.

> If the unittests run as they did before I could submit it
> afterwards.

Well, yes, they do - the same tests that failed for me before I
applied above patch still fail (same for passing tests).

Stefan

Index: src/main/com/internetcds/jdbc/tds/Tds.java
===================================================================
RCS file: /cvsroot/jtds/jtds/src/main/com/internetcds/jdbc/tds/Tds.java,v
retrieving revision 1.12
diff -u -r1.12 Tds.java
--- src/main/com/internetcds/jdbc/tds/Tds.java	2001/09/27 14:21:05	1.12
+++ src/main/com/internetcds/jdbc/tds/Tds.java	2001/11/19 12:11:56
@@ -613,7 +613,6 @@
     {
         PacketResult result = null;
         PacketResult tmp = null;
-        boolean okay = true;
         byte tmpByte;
         SQLException exception = null;
 
@@ -626,6 +625,13 @@
             do  // skip to end, why not ?
             {
                tmp = processSubPacket();
+               if (tmp instanceof PacketMsgResult) {
+                   SQLException thisMsg = 
+                       chain.addOrReturn((PacketMsgResult) tmp);
+                   if (thisMsg != null) {
+                       exception = thisMsg;
+                   }
+               }
                done = (tmp instanceof PacketEndTokenResult)
                   && (! ((PacketEndTokenResult)tmp).moreResults());
             } while (! done);
@@ -665,7 +671,7 @@
             throw new SQLException(e.getMessage());
         }
 
-        if (!okay) {
+        if (exception != null) {
             throw exception;
         }
 



Archive powered by MHonArc 2.6.24.

Top of Page