Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

more info on CallableStatement float problem

2 posts in JDBC Connect (product renamed to JConnect) Last posting was on 1997-04-09 20:32:03.0Z
chelsel Posted on 1997-04-08 21:04:04.0Z
Message-ID: <334AB2C4.505A@spacelab.net>
Date: Tue, 08 Apr 1997 17:04:04 -0400
From: chelsel <chelsel@spacelab.net>
Reply-To: chelsel@spacelab.net
X-Mailer: Mozilla 3.01 [fr] (WinNT; I)
MIME-Version: 1.0
Subject: more info on CallableStatement float problem
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Newsgroups: sybase.public.jdbcconnect
Lines: 45
Path: forums-1-dub!forums-master.sybase.com!forums.powersoft.com
Xref: forums-1-dub sybase.public.jdbcconnect:1045
Article PK: 252796

The following output was generated by enabling debug and the devclasses
of the latest jConnect from Sybase. It is only showing the DataFormat
class right before the CallableStatement.execute() method.

This problem causes bad float values (which are the middle two
parameters) to be sent to or stored in Sybase. For example, if the
second parameter of the CallableStatement is a float like 4.9 then it
will get sent to Sybase as 4.899999998939009 or 4.9000000988899 etc.
(these are not the actual numbers but very similar to what IS being
received in Sybase).

Any ideas, because I'm running out of them?

Thanks!

Cliff Helsel
chelsel@spacelab.net

output follows
***************************8
Turning on Debug
jdbc.sybase.tds.DataFormat(Thread[AWT-Callback-Win32,5,main]):
DataFormat:
column: null
, status = 0
, usertype = 0
, datatype = 39
, length = 3
, precision = 0
, scale = 0
, locale = null
jdbc.sybase.tds.DataFormat(Thread[AWT-Callback-Win32,5,main]):
DataFormat:
column: null
, status = 0
, usertype = 0
, datatype = 109
, length = 4
, precision = 0
, scale = 0
, locale = null
jdbc.sybase.tds.DataFormat(Thread[AWT-Callback-Win32,5,main]):
DataFormat:
column: null
, status = 0
, usertype = 0
, datatype = 109
, length = 4
, precision = 0
, scale = 0
, locale = null
jdbc.sybase.tds.DataFormat(Thread[AWT-Callback-Win32,5,main]):
DataFormat:
column: null
, status = 0
, usertype = 0
, datatype = 39
, length = 6
, precision = 0
, scale = 0
, locale = null
jdbc.sybase.tds.DataFormat(Thread[AWT-Callback-Win32,5,main]):
DataFormat:
column: null
, status = 0
, usertype = 0
, datatype = 56
, length = 4
, precision = 0
, scale = 0
, locale = null


Warren Master Posted on 1997-04-09 20:32:03.0Z
Message-ID: <334BFCC3.92C@nac.net>
Date: Wed, 09 Apr 1997 16:32:03 -0400
From: Warren Master <wsm@nac.net>
Reply-To: wsm@nac.net
Organization: MCS
X-Mailer: Mozilla 3.0 (Win95; I)
MIME-Version: 1.0
Subject: Re: more info on CallableStatement float problem
References: <334AB2C4.505A@spacelab.net>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Newsgroups: sybase.public.jdbcconnect
Lines: 59
Path: forums-1-dub!forums-master.sybase.com!forums.powersoft.com
Xref: forums-1-dub sybase.public.jdbcconnect:1042
Article PK: 252794


chelsel wrote:
>
> The following output was generated by enabling debug and the devclasses
> of the latest jConnect from Sybase. It is only showing the DataFormat
> class right before the CallableStatement.execute() method.
>
> This problem causes bad float values (which are the middle two
> parameters) to be sent to or stored in Sybase. For example, if the
> second parameter of the CallableStatement is a float like 4.9 then it
> will get sent to Sybase as 4.899999998939009 or 4.9000000988899 etc.
> (these are not the actual numbers but very similar to what IS being
> received in Sybase).
>
> Any ideas, because I'm running out of them?
>
> Thanks!
>
> Cliff Helsel
> chelsel@spacelab.net
>
> output follows
> ***************************8
> Turning on Debug
> jdbc.sybase.tds.DataFormat(Thread[AWT-Callback-Win32,5,main]):
> DataFormat:
> column: null
> , status = 0
> , usertype = 0
> , datatype = 39
> , length = 3
> , precision = 0
> , scale = 0
> , locale = null
> jdbc.sybase.tds.DataFormat(Thread[AWT-Callback-Win32,5,main]):
> DataFormat:
> column: null
> , status = 0
> , usertype = 0
> , datatype = 109
> , length = 4
> , precision = 0
> , scale = 0
> , locale = null
> jdbc.sybase.tds.DataFormat(Thread[AWT-Callback-Win32,5,main]):
> DataFormat:
> column: null
> , status = 0
> , usertype = 0
> , datatype = 109
> , length = 4
> , precision = 0
> , scale = 0
> , locale = null
> jdbc.sybase.tds.DataFormat(Thread[AWT-Callback-Win32,5,main]):
> DataFormat:
> column: null
> , status = 0
> , usertype = 0
> , datatype = 39
> , length = 6
> , precision = 0
> , scale = 0
> , locale = null
> jdbc.sybase.tds.DataFormat(Thread[AWT-Callback-Win32,5,main]):
> DataFormat:
> column: null
> , status = 0
> , usertype = 0
> , datatype = 56
> , length = 4
> , precision = 0
> , scale = 0
> , locale = null

SQL floats map to java floats therefore you need to use setDouble() for
a Sybase float in your callable statement..