Skip to Content.
Sympa Menu

freetds - Re: JDBC: Protocol confusion retrieving result of " SELECT @@IDENTITY"

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Bob Kline <bkline AT rksystems.com>
  • To: TDS Development Group <freetds AT franklin.oit.unc.edu>
  • Subject: Re: JDBC: Protocol confusion retrieving result of " SELECT @@IDENTITY"
  • Date: Wed, 12 Jul 2000 11:25:46 -0400 (EDT)


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





Archive powered by MHonArc 2.6.24.

Top of Page