The moose likes JDBC and the fly likes Connection has cached information? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "Connection has cached information?" Watch "Connection has cached information?" New topic
Author

Connection has cached information?

Andreas Bystrom
Ranch Hand

Joined: Mar 05, 2003
Posts: 32
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
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Connection has cached information?
 
Similar Threads
No output classes
how many objects will be eligible for garbage collection
SQL injection?
Garbage collection doubt
merging two lists inside a list