Hi, I have a problem about update table in a database. The situation is I have a table named member which store thousand rows of data records about thousand of member for a system. This member table has a field named MemberExpiryDate which used to store each member expired date. I have been asked to update the data records for member with member expired date equals to '2011/05/01'. So, as I count there are 50 of records (which member expired date is '2011/05/01') out of thousand of records in that member table need to be update. So, I write a Java program to update those 50 data records and the program is run without prompt out any error. But I have a question is how can I confirm that those 50 records out of thousand of records are updated completely and how can I confirm that other data except those 50 records are not affected and not updated ? Is it got any function in Java can let me know which record from those 50 records is not update exactly ? Is it got any method can let me know other data records except those 50 records are not affected ?

Thanks :)

You can see how many by inspecting the int return of the executeUpdate which tells you how many were affected. If you want to tell which ones, you are going to have to make a copy and compare, realising that other changes may have taken place between these actions.

You can see how many by inspecting the int return of the executeUpdate which tells you how many were affected. If you want to tell which ones, you are going to have to make a copy and compare, realising that other changes may have taken place between these actions.

Hi,

Thanks for your help. But I have a question that is you mentioned that I can going to have to make a copy and compare, realising that other changes may have taken place between these actions but since I have thousands of data in a table, so is it possbile to do that ?

Thanks. :)

Of course its possible. Anythings possible. It is not reliable, though.

Of course its possible. Anythings possible. It is not reliable, though.

ok. But if need copy and compare thousand of data, it may quite inconvenience and cost time. So, is it got any other solutions to make sure other data except those 52 records not be affected ?

Thanks :)

Yes, testing (on a different but equivalent database) until the code is correct.

Yes, testing (on a different but equivalent database) until the code is correct.

ok. Thanks for your help. :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.