MySQL Forums
Forum List  »  Replication

Problem setting connection to readOnly with ReplicationDriver, c3p0 & hibernate
Posted by: Beryl Tomay
Date: April 20, 2007 09:00PM

Hi,

I'm using c3p0 and hibernate with java and ReplicationDriver. I have one master and one slave. On certain read-only queries, I want to hit the slave instead of the master. I do this by session.connection().setReadOnly(true) right before I do beginTransaction().

My problem is with a query like this on a read-only connection hitting the slave:

select SQL_CALC_FOUND_ROWS distinct col1 from table1 where ...

The query results return FOUND_ROWS = 1, but the result list has size 0. Stopping the app and looking at the slave then, I see that there should be no results. Although I'm having trouble tracking down why FOUND_ROWS returns 1.

The problem seems to go away when I don't use c3p0. I haven't had too much luck anywhere else and I know this is not a c3p0 forum, but has anyone seen anything like this with ReplicationDriver? Or any tips on how I can debug it further?


Thanks.

Options: ReplyQuote


Subject
Views
Written By
Posted
Problem setting connection to readOnly with ReplicationDriver, c3p0 & hibernate
5314
April 20, 2007 09:00PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.