-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: SQL_CALC_FOUND_ROWS problem
PostPosted: Thu Oct 15, 2009 7:55 pm 
Newbie

Joined: Wed Mar 11, 2009 8:39 pm
Posts: 3
I am using JPA\Hibernate with MySql. I am executing a native query with SQL_CALC_FOUND_ROWS and a limit along with a "SELECT FOUND_ROWS()" query.

There are certain times where the found_rows query is returning the wrong result. I looked in the MySql query logs and saw that a query "SHOW CHARACTER SET" is being executed between the SQL_CALC_FOUND_ROWS query and the FOUND_ROWS query which messes up the FOUND_ROWS result.

Is the "SHOW CHARACTER SET" query being run by hibernate? If so, how can I prevent this?

Regards


Top
 Profile  
 
 Post subject: Re: SQL_CALC_FOUND_ROWS problem
PostPosted: Thu Nov 04, 2010 9:54 am 
Newbie

Joined: Thu Nov 04, 2010 9:39 am
Posts: 1
I know it's probably too late, anyway I got the same problem and looking into mysql-connector source code
i found you can set the following flag in the jdbc connection string :
useDynamicCharsetInfo=false

This will prevent the execution of SHOW CHARACTER SET query.

Bye,
D.


Top
 Profile  
 
 Post subject: Re: SQL_CALC_FOUND_ROWS problem
PostPosted: Thu Nov 04, 2010 10:15 am 
Newbie

Joined: Thu Nov 04, 2010 9:41 am
Posts: 1
Looks like the problem affects only MySQL 5.x.
Here is the bug listing on MySQL tracking site (2007, mind you):

http://bugs.mysql.com/bug.php?id=25978

Anyway, your workaround is still valid from 5.0.7 on.

Bye,
M.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.