Re: BigDecimal - Mailing list pgsql-jdbc

From Dave Cramer
Subject Re: BigDecimal
Date
Msg-id 004d01c1b30c$481f6100$8201a8c0@inspiron
Whole thread Raw
In response to BigDecimal  (Glenn Holmer <gholmer@weycogroup.com>)
List pgsql-jdbc
Glenn,

The latest driver does appear to implement BigDecimal. There is no
reason not to use this driver, it is quite independent of the version of
postgres.

FWIW I use a long for money and store everything in pennies, this
alleviates most rounding issues

Dave

-----Original Message-----
From: pgsql-jdbc-owner@postgresql.org
[mailto:pgsql-jdbc-owner@postgresql.org] On Behalf Of Glenn Holmer
Sent: Monday, February 11, 2002 9:46 AM
To: pgsql-jdbc@postgresql.org
Subject: [JDBC] BigDecimal


We're starting a Java project for our retail stores using Postgres, and
would like to store BigDecimal values for price, payment, etc. because
the data will be exported to an IBM iSeries server ("AS/400"). What is
the correct Postgres data type to use?  I would assume "decimal"; when
the docs say "User-specified precision" with a range of "~8000 digits"
does that mean the decimal point can fall anywhere within those 8000
digits?

I was able to write a BigDecimal into a field of type "decimal" using

statement.executeQuery("INSERT INTO TEST VALUES(" + myBigDecimal + ")");

but when I try to read using ResultSet.getBigDecimal(), I get an error
message saying it's not implemented.  We're using Postgres 7.0.3 on SuSE
Linux.  Should we upgrade to 7.1?  I realize 7.2 just came out, but we
prefer to install from SuSE RPMs, which I don't think are available yet.
Or is there a later driver that implements this, that we could use with
7.0 or 7.1?

--
____________________________________________________________
Glenn Holmer                          gholmer@weycogroup.com
Programmer/Analyst                       phone: 414.908.1809
Weyco Group, Inc.                          fax: 414.908.1601


---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster



pgsql-jdbc by date:

Previous
From: Glenn Holmer
Date:
Subject: BigDecimal
Next
From: "Steven Murphy"
Date:
Subject: Connection Problem with JDBC