MySQL Lists are EOL. Please join:

List:General Discussion« Previous MessageNext Message »
From:Mark Matthews Date:February 21 2005 3:24pm
Subject:Re: Problem with SUM and DECIMAL field
View as plain text  
Hash: SHA1

LAFONTAINE Julien - LYO wrote:
> Hi everyone,
> I've recentely upgarded my servers from MySQL 3.23.49 to MySQL 4.1.9.
> Now I have a problem when using the SUM operator on DECIMAL field.
> The value returned by the SUM operator when used with DECIMAL field has a
> coma (,) as decimal separator while it used to be have a dot (.) . If I
> query my table to display the DECIMAL fields (SELECT * FROM ...)  I get a
> dot as decimal separator as expected.
> This doesn't look like a big issue but it prevents Connector/J from
> retieving the data properly. Connector/J can't parse the value of the field
> as it's expecting a dot as decimal separator.
> Here is the stack trace :
> java.sql.SQLException: Bad format for BigDecimal '12660,95' in column 1( .
> () . SUM(AMFTPF)()).
>             at com.mysql.jdbc.ResultSet.getBigDecimal(
> I'm using Connector/J 3.0.16.
> One last thing : this seems to happen only on AIX. I have tried on Linux and
> Windows XP and everything works as expected.
> Is there something wrong with some of my database parameters or is this a
> bug ?
> Please let me know if someone is interested by a testcase.
> Reagrds,


Connector/J uses the locale of the _client_ computer to parse numbers.
It seems your AIX box and your MySQL compile are 'sensitive' to the
locale, and thus returning numbers formatted different than your client
expects them.

If you use the 'mysql' client, does it show decimal numbers with comma
separators as well?

Since MySQL doesn't actually have configurable locale, and doesn't
expose this information in any status variable, you will have to set
your client to the same locale as your server to get these numbers to
parse, see:



- --
Mark Matthews
MySQL AB, Software Development Manager - Client Connectivity

MySQL User Conference (Santa Clara CA, 18-21 April 2005)
Early registration until February 28:
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Thunderbird -

Problem with SUM and DECIMAL fieldLAFONTAINE Julien - LYO17 Feb
  • Re: Problem with SUM and DECIMAL fieldGleb Paharenko21 Feb
  • Re: Problem with SUM and DECIMAL fieldMark Matthews21 Feb
RE: Problem with SUM and DECIMAL fieldLAFONTAINE Julien - LYO24 Feb
  • Re: Problem with SUM and DECIMAL fieldMark Matthews24 Feb