Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

executeUpdate() returns 0 rows even though target DB has been updated

Status
Not open for further replies.

BillyKrow

Programmer
Aug 27, 2001
67
US
My subject describes my problem exactly. I have an executeUpdate() command that updates an Orale database like:

int rows = statement.executeUpdate();
statement.close();

if (rows == 0) {
System.out.println("Zero rows updated
throw new MyException ("Zero rows were updated");
}

If I leave the check in, an exception is thrown and the database is eventually rolled back. If I take the check out then the database updates successfully. Is there any rare situations that executeUpdate could return 0 but still update successfully?
 
You have to remember that while the JavaDoc :
[ignore][/ignore]

states that the int returned should be the number of rows affected, JDBC drivers can (in reality) implement the JDBC interfaces as they like. So if they return, for example, 0 for good updates, 1 for failures, then so be it. I expect your driver is not implementing the spec properly. I doubt its anything to worry about ....

--------------------------------------------------
Free Database Connection Pooling Software
 
Yes, I read something to this effect, that the driver may be the issue. It's strange though that I've never seen this problem in any other similar updateStatements.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top