This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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 Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
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: 1081

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
jQuery in Action, 2nd edition
subject: PreparedStatement executeUpdate()
Similar Threads
diff bw execute and executeUpdate()
Please help me on this insert statement and pass it to the servlet
executing an INSERT statement using a PreparedStatement
inserting values in database....
problem accessing two tables from servlet