• 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
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Transactions

 
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

It seems to me that if a trnasaction has not been commited; I should not be in the database and therefore; I should not be able to see in the result set before printing and I should not be able to see in the print out statement. In this program I commit the first insert query only; but not the second. Then I read from the database and print. It seems that as long as the select query is issued; even if the insert has has not been committed yet; the value has been inserted in the database and it can be printed. Also, the second connection; can read the data and print it becuase it is in the database. I do not udnerstand. Could any body read my code?
Thank you.



it prints thefollwing:

id name
---------
1 nameValue
2 nameValue

id name
----------
1 nameValue
2, nameValue
 
Bartender
Posts: 2662
19
Netbeans IDE C++ Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You might see a dirty read.
What happens if you uncomment your setTransactionIsolation() call for conn2?
 
Giuseppa Cefalu
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have tried uncommenting conn1 isolation level only, conn2 isolation level only and both and I keep getting the same result. I wonder if the setTransationIsolation is working. May be I need some permissions to get it working?

 
Giuseppa Cefalu
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is anew version of the same problem. I have looked in many places to see how this is done and it seems that I am writing this code correctly. Still get a dirty read though. Any ideas of wht might be going wrong? The output is:
transation isolation level = 4
Transaction isolation level c1 set to 8
Transaction isolation level c2 set to 8
id name
----------
1 foo

id name
-----------
1 foo
2 bar

Thank you




 
He baked a muffin that stole my car! And this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic