From: | Richard Welty <rwelty(at)averillpark(dot)net> |
---|---|
To: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | Re: any issues with SQL arrays of decimals? |
Date: | 2003-02-22 21:47:24 |
Message-ID: | E18mhUT-0003VL-00@skipper.averillpark.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
following myself up:
On Sat, 22 Feb 2003 15:00:21 -0500 (EST) Richard Welty <rwelty(at)averillpark(dot)net> wrote:
> i have a bunch of code that was working with integer arrays which i just
> converted to work with decimals.
>
> the array is in the database correctly. from psql, target_percentages is:
>
> {0.08,0.08,0.09,0.08,0.08,0.09,0.08,0.08,0.09,0.08,0.08,0.09}
i the following alternate code to read the array:
java.sql.Array tp = result.getArray( "target_percentages");
target_percentages = getBigDecimalArray( tp, 12);
where getBigDecimalArray is as follows:
public static BigDecimal [] getBigDecimalArray( java.sql.Array array, int len){
BigDecimal [] bdarray = new BigDecimal [len];
try {
ResultSet rs = array.getResultSet();
int index;
BigDecimal num;
while( rs.next()){
index = rs.getInt( 1);
bdarray[index - 1] = rs.getBigDecimal( 2);
}
} catch ( SQLException ex){
Debug.println( "SQLException: " + ex.getMessage());
}
return bdarray;
}
> this is postgresql 7.2.1-5 from an rpm on redhat 7.3, using the
> pgjdbc2.jar
> driver from october of last year. the jdk is 1.4.1_01
i also updated to the pg72jdbc2.jar file from the pgjdbc website.
it is continuing to fail with the same error message,
SQLException: Bad BigDecimal 0.08
is there any known way to read an array of decimal values into a BigDecimal
array?
thanks,
richard
--
Richard Welty rwelty(at)averillpark(dot)net
Averill Park Networking 518-573-7592
Unix, Linux, IP Network Engineering, Security
From | Date | Subject | |
---|---|---|---|
Next Message | Jim Rosenberg | 2003-02-22 21:53:59 | SQLJ for PostgreSQL, anywhere? |
Previous Message | Richard Welty | 2003-02-22 20:00:21 | any issues with SQL arrays of decimals? |