Paul Clapham wrote:Its also worth considering that updating zero records may be correct, if there's nothing in the table matching the "fon" variable. This could happen if the "fon" variable isn't what you think it is, or if the data in that column isn't what you think it is. Commonly this happens when one of the two has whitespace that the other one didn't have. So using this code could help you with that:
The columns which is to be updated is the 61st column of the table!
Pranit Sonawane wrote:now can you believe something! I mean this is not good! I have been working on this query for a whole day! Dint get any positive reply! Which irritated me a lot!
But I saw your reply people!
Thanks a lot to each n every one of you guys for your great help honestly I'm please to be a member of this forum!
Anyways the current status is that I pasted the same query again and also updated the code and added Paul's Suggestion. And finally at the end it prints "1"
Not working
Also, MySQL's column limit is actually a row limit, that is a single row can only hold some 64k.
From the docs.
You would get an error if you exceeded that, though.
By default, MySQL runs with autocommit mode enabled. This means that as soon as you execute a statement that updates (modifies) a table, MySQL stores the update on disk to make it permanent.
In addition I'm not sure why you now have two connections?
Surely this is a single transaction, so requires a single connection to work with?
Paul Clapham wrote:Dave, from the MySQL documentation:
By default, MySQL runs with autocommit mode enabled. This means that as soon as you execute a statement that updates (modifies) a table, MySQL stores the update on disk to make it permanent.
So the commit issue doesn't apply here, I don't think.
Paul Clapham wrote:
There are other possibilities such as updating the table in schema X, then looking at the same table in schema Y and finding it not updated. This sort of error is quite likely as the posted code does update the table -- if the executeUpdate() method returns 1, which we haven't been told. I would also recommend using PreparedStatement correctly (i.e. with ? parameters to set) instead of using the error-prone string concatenation method.
Pranit Sonawane wrote:Thanks for your reply people but Dave you said
In addition I'm not sure why you now have two connections?
Surely this is a single transaction, so requires a single connection to work with?
I have to run the update query for 800 records so I thought it would be better to open and close connection every time, else I'll get the Too Many Connections exception! So I did that.
please buy this thing and then I get a fat cut of the action:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
|