File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC 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 Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "executeUpdate() not working" Watch "executeUpdate() not working" New topic
Author

executeUpdate() not working

Rakesh Keerthi
Ranch Hand

Joined: Jul 16, 2012
Posts: 136
Hi,
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.



Thanks
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
SCJP | SCWCD | OCA
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60752
    
  65

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: http://aspose.com/file-tools
 
subject: executeUpdate() not working
 
Similar Threads
Compare textbox data with sql table data
Decryption technique is not working in the JSP page
Oracle table takes Null
Date, time and timestamp
Returning a 0 value error