aspose file tools*
The moose likes JDBC and the fly likes problem insert with DB2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "problem insert with DB2" Watch "problem insert with DB2" New topic
Author

problem insert with DB2

Laurent S
Greenhorn

Joined: Sep 27, 2001
Posts: 15
I have this insert procedure

and at the instruction: rs.moveToInsertRow(); i have a error:
Exception occurred during event dispatching:
java.lang.AbstractMethodError
at TreeFrame.insert(TreeEdit.java:308)
at TreeFrame.actionPerformed(TreeEdit.java:350)
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.Component.processMouseEvent(Component.java:3717)
someone can help me?
[This message has been edited by Laurent S (edited September 27, 2001).]
Jamie Robertson
Ranch Hand

Joined: Jul 09, 2001
Posts: 1879

why go through all that trouble and code for an insert? It is faster and more efficient in this case to use traditional SQL:

Is there any reason you need the programmatic Insert? even better than my above suggestion is to use PreparedStatement instead of Statement.
Jamie
Jamie Robertson
Ranch Hand

Joined: Jul 09, 2001
Posts: 1879

as to the original error message: You are using a driver that does not support programmatic updates. What jdk version are you using (ie 1.3.1) and which driver/database...my guess is Access and jdbc dbc bridge? anyways check your driver documentation to see if it supports programmatic updates.(you also may have to update your database odbc driver-->MDAC I believe)
Jamie
Laurent S
Greenhorn

Joined: Sep 27, 2001
Posts: 15
With the standard way for a insert, you can't insert a string with quote in it...
Jamie Robertson
Ranch Hand

Joined: Jul 09, 2001
Posts: 1879

Originally posted by Laurent S:
With the standard way for a insert, you can't insert a string with quote in it...

This is the reason I suggested PreparedStatement! It is great because it deals with all the special characters so us programmers do not!


Any ',",%,*, etc special characters should be taken care of if you jdbc driver is correctly implemented. Give it a try,
Jamie
Laurent S
Greenhorn

Joined: Sep 27, 2001
Posts: 15
Thanx a lot Jamie.
In fact i haven't read your advice before about PreparedStatement. Now it's working with that
For my first question, my driver doesn't support the updatable set function.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: problem insert with DB2