This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
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


Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
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: 1082

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’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: PreparedStatement executeUpdate()
 
It's not a secret anymore!