[Zope-DB] Re: Floating point errors

M.-A. Lemburg mal at egenix.com
Mon Feb 4 05:34:07 EST 2008


On 2008-02-04 08:19, siribu wrote:
> Hi,
> 
> I found the a solution to the problem, it cannot be done just by " Leave scale 0 
> floats untouched ?"   which I tried, but also the Oracle parameter 
> NLS_NUMERIC_CHARACTERS needed to be set explicitly. 
> See http://www.osdir.com/ml/web.zope.database/2003-01/msg00036.html. That solved 
> things for me.
> 
> Anyway, thanks Marc-Andre  :-)

You're welcome.

Could you explain why you had to set the NLS_NUMERIC_CHARACTERS variable ?

Is this needed for the ODBC driver to convert numbers to and from
strings correctly ?


> *On Sun Feb 3 12:37 , "M.-A. Lemburg" sent:
> 
> *
> 
>     On 2008-01-23 14:35, siribu wrote:
>     >  Hi,
>     >
>     >
>     >
>     >  I have got a problem:
>     >
>     >
>     >
>     >  accessing an Oracle 10g database, whenever I ask for floats from a Zope Z SQL
>     >  method, they are automatically converted to integers, simply dropping the
>     >  decimal numbers.
>     >
>     >
>     >
>     >  I am using Zope 2.10.4-final with Python 2.4.4 running on a Linux2 OS.
>     >  Furthermore, I am using UnixODBC with Easysoftâ€^(TM)s ODBC-Oracle driver
>     together
>     >  with eGenix *mxODBC Zope DA*.
> 
>     There's a connection option " Leave scale 0 floats untouched ?" to switch
>     this off.
> 
>     The truncation to integers is done because some database drivers always
>     return numbers as floats - even integers. Zope would then display these
>     as floats (without additional formatting), which may not look right to
>     the user.
> 
>     >  Running iSQL on the server or even utilizing the mxODBC Zope DA driver
>     directly
>     >  in Python works well without problems.
>     >
>     >
>     >
>     >  The error logs for the ODBC contained no sign or errors. Neither did I get
>     any
>     >  response when I ran Event Log Manager in Zope. I could not find anything
>     in syslog.
>     >
>     >
>     >
>     >  Any clues on how to solve this?
> 
>     See above: just switch on the option in the connection properties.
> 
>     -
>     Marc-Andre Lemburg
>     eGenix.com
> 
>     Professional Python Services directly from the Source (#1, Feb 03 2008)
>     > >> Python/Zope Consulting and Support ... http://www.egenix.com/
>     <http://epost.start.no/mail/parse.pl?redirect=http%3A%2F%2Fwww.egenix.com%2F>
>     > >> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
>     <http://epost.start.no/mail/parse.pl?redirect=http%3A%2F%2Fzope.egenix.com%2F>
>     > >> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/
>     <http://epost.start.no/mail/parse.pl?redirect=http%3A%2F%2Fpython.egenix.com%2F>
>     ________________________________________________________________________
> 
>     :::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! ::::
> 
> 
>     eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48
>     D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
>     Registered at Amtsgericht Duesseldorf: HRB 46611
> 
> 
> -------------------------------------------------------------------------
> Få din egen, gratis e-postadresse på Start.no <http://www.start.no/>
> 

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Feb 04 2008)
>>> Python/Zope Consulting and Support ...        http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________

:::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! ::::


   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
    D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
           Registered at Amtsgericht Duesseldorf: HRB 46611


More information about the Zope-DB mailing list