This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
I have application connecting and getting data from Mysql database.
And i have problem to do this:
Ok, it works, but only if there is field_name2 with valueX
So when there isnt i would execute new statement with INSERT.
I know how to get data from mysql and so on, i just would request some help with already mentioned problem, check if field with given value exist, if yes update it with X in field Y, if not insert new ready entry with proper needed data.
I don't see where exceptions would come into the process. Do a SELECT which looks for the record which may or may not be there; if that query returns zero rows then it isn't there, so do an INSERT. If the query returns a row, then do an UPDATE.