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

executeUpdate() is not working

Sujoy Mukherjee
Ranch Hand

Joined: Dec 31, 2005
Posts: 51

Dear friends, I have a problem with my jdbc code.
I am using Oracle 10G Express edition.
I have a table named stars.
The ddl statement was:

Ans the code is:

The output is showing as
No. of rows updated: 0
I am simply clueless. please help me.
Thanks in advance.
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33117

If you run "select * from stars where job_id='AD_PRE'" at the sql command line, does it return anything?

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Sujoy Mukherjee
Ranch Hand

Joined: Dec 31, 2005
Posts: 51

Nope. I have checked.....It has not been updated at all.
I don't know why??
Mahesh Gadgil

Joined: Jun 16, 2011
Posts: 2
Stars table does neither have job_id nor job_title as fields, but you are using them in your prepared statement?
Include the update code in try catch block so you can see the exception thrown.
Sujoy Mukherjee
Ranch Hand

Joined: Dec 31, 2005
Posts: 51

Oops! My apology. Thanks Mahesh.
Actually when I was unable to update data on stars table I was trying that code with jobs table but the result was same that means no updation happened to jobs table also. So when i was posting the code mistakenly I has copied the last code where jobs table was used.

Anyway I have modified the code for stars table using try catch block. Have a look:

The output is:
No. of rows updated: 0 Connection closed

Still its not working.

Rob Spoor

Joined: Oct 27, 2005
Posts: 20274

And you're absolutely sure there is a record in table "stars" with id 111111?

How To Ask Questions How To Answer Questions
I agree. Here's the link:
subject: executeUpdate() is not working
It's not a secret anymore!