File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes PreparedStatement executeUpdate() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "PreparedStatement executeUpdate()" Watch "PreparedStatement executeUpdate()" New topic

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

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();
Shailesh Chandra
Ranch Hand

Joined: Aug 13, 2004
Posts: 1082

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


Gravitation cannot be held responsible for people falling in love ~ Albert Einstein
I agree. Here's the link:
subject: PreparedStatement executeUpdate()
It's not a secret anymore!