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

executeUpdate() not working

Rakesh Keerthi
Ranch Hand

Joined: Jul 16, 2012
Posts: 149
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: 63838

Read this JspFaq entry.

[Asking smart questions] [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!