I was trying to read a table with money column using JDBC driver(version 42.2.2). JDBC driver returns data type as double and it internally tries to use ResultSet.getDouble when ResultSet.getObject() is used.
org.postgresql.util.PSQLException: Bad value for type double : 1,000.00
at org.postgresql.jdbc.PgResultSet.toDouble(PgResultSet.java:2930)
at org.postgresql.jdbc.PgResultSet.getDouble(PgResultSet.java:2317)
at org.postgresql.jdbc.PgResultSet.internalGetObject(PgResultSet.java:194)
at org.postgresql.jdbc.PgResultSet.getObject(PgResultSet.java:2568)
at jdbc_sample_latest.PostgresSSL.main(PostgresSSL.java:74)
What is the fix or work-around here to get rid of this error? My application is a generic application and I expected that driver would take care of retrieving money data type when using ResultSet.getObject() but unfortunately driver isn’t working as expected.
P.S.> I have seen the discussion on the same issue on forum but couldn’t find a solution for the same.