Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Connection has cached information?

 
Andreas Bystrom
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a problem with my Java connections to a mySQL database.
In my scenario I have a connection pool, and the behavior is different depending on the size of this pool.
Scenario 1:
I have 2 connections in the pool (c1 and c2). The table I'm about to read has 2 records. I use c1 to read and get two records. I then use c2 to add another record (this works, if I look in the database, the new record is there). I commit the changes. I then use c1 to read the same table but still gets only to records (the same two as before).
Scenario 2:
I have 3 connections (c1, c2 and c3). The table again has two records. I use c1 to read and get this two records. I then use c2 o add a new record and commit the changes. Then I use c3 to read the same table and now I get 3 records (the to "old" and the newly added).
My question is if there can be some kind of chache in the connections? Have someone come across this behavior before? The connections TransactionIsolation is set to TRANSACTION_READ_COMITTED.
Thanks in advance,
Andreas
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic