JDBC: Protocol confusion retrieving result of " SELECT @@IDENTITY"

Bob Kline bkline at rksystems.com
Wed Jul 12 11:25:46 EDT 2000


On Wed, 12 Jul 2000, Emmanuel Blot wrote:

> Sorry, I am a beginner in both SQL and JDBC.
> 
> How should I write this cast (and where) ?
> 

Here's another workaround until the patches are in place.  Replace the
method getDecimalValue in Tds.java with the following:

   private Object getDecimalValue(int t, int p, int scale)
      throws TdsException, java.io.IOException, NumberFormatException
   {
      int len = comm.getByte() & 0xff;
      if (--len < 1)
         return null;

      // RMK 2000-06-10.  Deduced from some testing/packet sniffing.
      byte[] bytes = new byte[len];
      int signum = comm.getByte() == 0 ? -1 : 1;
      while (len > 0)
          bytes[--len] = comm.getByte();
      BigInteger bigInt = new BigInteger(signum, bytes);
      return new BigDecimal(bigInt, scale);
   }


-- 
Bob Kline
mailto:bkline at rksystems.com
http://www.rksystems.com




More information about the FreeTDS mailing list