Thread: JDBC : problem to update DECIMAL column.

JDBC : problem to update DECIMAL column.

From
Igor Hribik
Date:
Hello,
we are using jdbc6.5-1.2.jar driver for connection to PostgreSQL
database. We have a problem to update DECIMAL column when we are using
CachedRowSet in JDBC application created inside Forte for Java IDE. We
suppose this a bug in driver. From our investigations it seems it might
be a problem with PreparedStatement. See below steps to reproduce in
Forte for Java. Anyway we think the most important is this error
message:

ERROR:  Unable to identify an operator '=' for types 'numeric' and
'float8'
        You will have to retype this query using an explicit cast

Please could you inform us, if this issue will be solved by you or if
there is new version of driver.

Thank you.

Igor Hribik
Quality Assurance Engineer, Forte Tools
Software Platforms and Products
Sun Microsystems Czech s.r.o.
E-mail:igor.hribik@czech.sun.com

====================================================================================

It is impossible to update decimal value in PostreSQL database.

- create a table with one row (e.g. dec1 DECIMAL(15,5))
- generate application with JTable and DataNavigator showing this table
(e.g. by JDBC Form Wizard)
- add new row, fill in the column decimal value (e.g. 12.34), push
accept changes
- now it is OK, changes were successfully saved into database
- try to modify the value and push accept button
- exception is thrown and it is not possible to change the value

ERROR:  Unable to identify an operator '=' for types 'numeric' and
'float8'
        You will have to retype this query using an explicit cast

java.sql.SQLException: acceptChanges Failed
        at
sun.jdbc.rowset.CachedRowSet.acceptChanges(CachedRowSet.java:791)
        at
org.netbeans.lib.sql.DataNavigator.updateButtonActionPerformed(DataNavigator.java:345)

        at
org.netbeans.lib.sql.DataNavigator.access$600(DataNavigator.java:31)
        at
org.netbeans.lib.sql.DataNavigator$7.actionPerformed(DataNavigator.java:165)

        at
javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1450)

        at
javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1504)

        at
javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:378)

        at
javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:250)
        at
javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:216)

        at
java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:230)

        at java.awt.Component.processMouseEvent(Component.java:3715)
        at java.awt.Component.processEvent(Component.java:3544)
        at java.awt.Container.processEvent(Container.java:1165)
        at java.awt.Component.dispatchEventImpl(Component.java:2593)
        at java.awt.Container.dispatchEventImpl(Container.java:1214)
        at java.awt.Component.dispatchEvent(Component.java:2497)
        at
java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:2452)
        at
java.awt.LightweightDispatcher.processMouseEvent(Container.java:2217)
        at
java.awt.LightweightDispatcher.dispatchEvent(Container.java:2126)
        at java.awt.Container.dispatchEventImpl(Container.java:1201)
        at java.awt.Window.dispatchEventImpl(Window.java:912)
        at java.awt.Component.dispatchEvent(Component.java:2497)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:333)
        at
java.awt.EventDispatchThread.pumpOneEvent(EventDispatchThread.java:103)
        at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:84)




Re: JDBC : problem to update DECIMAL column.

From
Peter T Mount
Date:
Quoting Igor Hribik <igor.hribik@czech.sun.com>:

> Please could you inform us, if this issue will be solved by you or if
> there is new version of driver.

7.1 is currently in beta, and is the most complete driver to date.

--
Peter Mount peter@retep.org.uk
PostgreSQL JDBC Driver: http://www.retep.org.uk/postgres/
RetepPDF PDF library for Java: http://www.retep.org.uk/pdf/