File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem insert with DB2

 
Laurent S
Greenhorn
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1879
MySQL Database Suse
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1879
MySQL Database Suse
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
With the standard way for a insert, you can't insert a string with quote in it...
 
Jamie Robertson
Ranch Hand
Posts: 1879
MySQL Database Suse
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic