• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

not sure why my transaction isn't producing the desired results

 
Ranch Hand
Posts: 389
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please consider the following code. Since, my main question revolves around the usage of transaction, I haven't bothered to include full code here. The following code just gives an overwiew of what I am doing and what results I am getting after running the program. If you would like to look at an actual code, please take a look here. However, I feel that the following code snippet is sufficient for understanding my question. Thanks

So, I have something like the following inside the try block:




More information:

- DTSId_int is a field that exists in the MySQL table for all the IP addresses above. IT's a primary key and set to autoincrement.

- DTSStatusType_ti is initially set to 1 in test.selectiontable and then getting updated to 3



**My Question:**



When I check the results of prepared statement, I get the following, when the for loop runs for the first time:



When for loop runs for the second time, I get the following results:





**Problem I am facing:**

The problem here is, the first 10 values in `test.selectiontable` is getting updated three times at a time. Eventually, it get's updated with the most recent value, which is 44.44.4.444.

I want something like following results which makes sense:

Please let me know what am I doing wrong in my transaction related code.

Thanks

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic