Lists: | pgsql-jdbc |
---|
From: | Holger Schulz <hst1(at)online(dot)de> |
---|---|
To: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | Bug extracting money value |
Date: | 2006-09-30 23:09:04 |
Message-ID: | rPIjYa0u87xbEkf7wiWlAPS3aOby2tyLTfkRCNbvOP1@akmail |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-jdbc |
Hello!
I always get an exception when I try to extract the money value I inserted this way:
insert into public."dbtypes" ("cmoney") values ('7').
Java:
Object oValue = m_resultSet.getObject(i);
Stacktrace (postgresql-8.2dev-503.jdbc3.jar):
org.postgresql.util.PSQLException: Bad value for type double : ?7,00
at org.postgresql.jdbc2.AbstractJdbc2ResultSet.toDouble(AbstractJdbc2ResultSet.java:2594)
at org.postgresql.jdbc2.AbstractJdbc2ResultSet.getDouble(AbstractJdbc2ResultSet.java:1975)
at org.postgresql.jdbc2.AbstractJdbc2ResultSet.internalGetObject(AbstractJdbc2ResultSet.java:132)
at org.postgresql.jdbc3.AbstractJdbc3ResultSet.internalGetObject(AbstractJdbc3ResultSet.java:39)
at org.postgresql.jdbc2.AbstractJdbc2ResultSet.getObject(AbstractJdbc2ResultSet.java:2291)
resultSet.getDouble(i); doesn't work either.
resultSet.getString(i); returns '?7,00' without exception.
Tested with:
PostgreSQL 8.1.4 on Windows 2000
JDBC driver: postgresql-8.2dev-503.jdbc3.jar AND postgresql-8.1-407.jdbc3.jar
Thanks
Holger
From: | Oliver Jowett <oliver(at)opencloud(dot)com> |
---|---|
To: | Holger Schulz <hst1(at)online(dot)de> |
Cc: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | Re: Bug extracting money value |
Date: | 2006-10-01 21:11:33 |
Message-ID: | 45202F05.4050602@opencloud.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-jdbc |
Holger Schulz wrote:
> I always get an exception when I try to extract the money value I inserted this way:
"money" isn't a well-supported type on the server side (I believe its
use is no longer recommended) .. IIRC the formatting rules for it are
locale-specific, among other problems.
> Object oValue = m_resultSet.getObject(i);
> org.postgresql.util.PSQLException: Bad value for type double : ?7,00
... though I'd expect at least getObject to work, if not getDouble()
Maybe you could dig into this and send us a patch?
-O
From: | Markus Schaber <schabi(at)logix-tt(dot)com> |
---|---|
To: | pgsql-jdbc(at)postgresql(dot)org |
Cc: | Holger Schulz <hst1(at)online(dot)de> |
Subject: | Re: Bug extracting money value |
Date: | 2006-10-02 07:03:59 |
Message-ID: | 4520B9DF.1030901@logix-tt.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-jdbc |
Hi, Oliver,
Oliver Jowett wrote:
>> I always get an exception when I try to extract the money value I
>> inserted this way:
>
> "money" isn't a well-supported type on the server side (I believe its
> use is no longer recommended) .. IIRC the formatting rules for it are
> locale-specific, among other problems.
Without having looked at the code, I think that the ? in getString()
comes from the backend formatting the Value with an EUR symbol, and the
JDBC driver looking for a $ to skip.
HTH,
Markus
--
Markus Schaber | Logical Tracking&Tracing International AG
Dipl. Inf. | Software Development GIS
Fight against software patents in Europe! www.ffii.org
www.nosoftwarepatents.org
From: | Markus Schaber <schabi(at)logix-tt(dot)com> |
---|---|
To: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | Re: Bug extracting money value |
Date: | 2006-10-02 07:36:21 |
Message-ID: | 4520C175.7040100@logix-tt.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-jdbc |
Hi, All,
Markus Schaber wrote:
> Without having looked at the code, I think that the ? in getString()
> comes from the backend formatting the Value with an EUR symbol, and the
> JDBC driver looking for a $ to skip.
I now looked at the code.
It seems that the Code tries to strip brackets () and anything outside
of them, however, I did not get my backend to generate anything
containing brackets.
With the US locale, it generated '$5.00' and '-$5.00', with the european
locale, it generated '5.00' and '-5.00'.
HTH
Markus
--
Markus Schaber | Logical Tracking&Tracing International AG
Dipl. Inf. | Software Development GIS
Fight against software patents in Europe! www.ffii.org
www.nosoftwarepatents.org
From: | Dave Cramer <pg(at)fastcrypt(dot)com> |
---|---|
To: | Oliver Jowett <oliver(at)opencloud(dot)com> |
Cc: | Holger Schulz <hst1(at)online(dot)de>, pgsql-jdbc(at)postgresql(dot)org |
Subject: | Re: Bug extracting money value |
Date: | 2006-10-02 11:15:36 |
Message-ID: | 35A36432-5E5A-4A44-8C9E-6F66F76F56D3@fastcrypt.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-jdbc |
On 1-Oct-06, at 5:11 PM, Oliver Jowett wrote:
> Holger Schulz wrote:
>
>> I always get an exception when I try to extract the money value I
>> inserted this way:
>
> "money" isn't a well-supported type on the server side (I believe
> its use is no longer recommended)
This is still being debated, and will likely be reversed as there is
a proposal on the table for a new improved money type
> .. IIRC the formatting rules for it are locale-specific, among
> other problems.
>
>> Object oValue = m_resultSet.getObject(i);
>
>> org.postgresql.util.PSQLException: Bad value for type double : ?7,00
>
> ... though I'd expect at least getObject to work, if not getDouble()
>
> Maybe you could dig into this and send us a patch?
>
> -O
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 3: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faq
>