• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Transactions

 
Giuseppa Cefalu
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • 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
 
Jan Cumps
Bartender
Posts: 2599
12
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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




 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic