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 executeUpdate() not working 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 "executeUpdate() not working" Watch "executeUpdate() not working" New topic

executeUpdate() not working

Rakesh Keerthi
Ranch Hand

Joined: Jul 16, 2012
Posts: 146
Below is the code that i used to do executeUpdate(), it is not showing any exceptions and also it is not updating the table. to check if there are any null values i've printed the individual outputs but they are fine.

Ashwin Sridhar
Ranch Hand

Joined: Jul 09, 2011
Posts: 272

Having scriptlets inside a JSP is a bad approach in first place. You could have this code snippet in servlet.
Capture the return value of ps.executeUpdate() and check. It tells the number of rows affected by the query.

Ashwin Sridhar
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63232

Read this JspFaq entry.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Wei Dai
Ranch Hand

Joined: Jun 22, 2005
Posts: 86
> ps.executeUpdate();

int updatedCount=ps.executeUpdate();
System.out.println(updatedCount); //should print 0, then you should check your where clause.
I agree. Here's the link:
subject: executeUpdate() not working
It's not a secret anymore!