Re: Mapping Java BigDecimal

From: dmp <danap(at)ttc-cmc(dot)net>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Mapping Java BigDecimal
Date: 2010-01-20 04:27:46
Message-ID: 4B568642.1000004@ttc-cmc.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

> I would like to disagree with the statement that PostgreSQL
> numeric is a real with rounding to the precision specified.

I concede my mis-statement.

> Hi All,
>
> We decide add support PostgreSQL database (now supporting only Oracle
> database) to our product.
>
> In Oracle we mapping Java BigDecimal to number(19, 2), in PostgreSQL
> to numeric(19, 2).
>
> If I store to "BigDecimal column" number without decimal, e.g. "3",
> than Oracle JDBC driver return "3", but PostgreSQL JDBC driver return
> "3.00".
>
> Is there some way (mapping, server setup, jdbc driver setup,...) how
> reach return number without trailing zeroes on decimal position?
>
> I'm using JDBC4 PostgreSQL Driver (v. 8.4-701) and PostgreSQL v.
> 8.1.18 (default for CentoOS 5.3).
> Thank you all

Oracle NUMBER(19,2), (precision,scale) is just the same as
NUMERIC(19,2), but if do

Oracle NUMBER(19,2) ----> PostgreSQL Numeric, no precision yields the
desired result
as Jakub has figured out and keeps whatever precision input.

danap.

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Donald Fraser 2010-01-20 10:02:19 Re: Mapping Java BigDecimal
Previous Message Donald Fraser 2010-01-19 19:18:06 Re: Mapping Java BigDecimal