File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes PreparedStatement executeUpdate() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "PreparedStatement executeUpdate()" Watch "PreparedStatement executeUpdate()" New topic
Author

PreparedStatement executeUpdate()

vivek ja
Ranch Hand

Joined: Feb 24, 2005
Posts: 80
I am trying to insert data into a table using executeUpdate()
The insert is not happening at all, I am not getting any error also.
How can i find out what the problem is?
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Can you post your code? Otherwise all we can do is guess...


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Wei Dai
Ranch Hand

Joined: Jun 22, 2005
Posts: 86
Try Connection.commit();
vivek ja
Ranch Hand

Joined: Feb 24, 2005
Posts: 80
Here is the code, I am doing a commit after executeUpdate.

SQL_CREATE_AGES = "insert into TABLE1 (COL1, COL2, COL3, COL4) VALUES (?,?,?,?);
stmt = argCon.prepareStatement(SQL_CREATE_AGES);
stmt.setInt(++ndx, nextId);
stmt.setString(++ndx, "AAA");
stmt.setString(++ndx, "BBB");
stmt.setString(++ndx, "CCC");
numRows = stmt.executeUpdate();
argCon.commit()
Shailesh Chandra
Ranch Hand

Joined: Aug 13, 2004
Posts: 1081

are you sure if there is no exception !! might be there is some exception you are catching but not handling with.

Shailesh


Gravitation cannot be held responsible for people falling in love ~ Albert Einstein
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: PreparedStatement executeUpdate()