blocked resultSet.next()
Posted by: Anthony Cros
Date: February 11, 2010 11:40AM

Hi everyone,

I've been looking around for a little while to see if others have run into the same problem, but it seems i'm alone on this one..!

I often run into the problem with some queries whereby the method resultSet.next() seems to block, it gets in but never comes out, therefore neither returning null, false or throwing any exception. I should mention that usually the queries are particularly long, and that it only seems to happen with MySql (not Postgres or Oracle), hence my posting here and not on a JDBC forum.

As strange as it may sound, a workaround it is to add "LIMIT any-huge-number" (like "LIMIT 100000000000" for instance. BUT that's not bulletproof either, i sometimes have queries that fail in spite of it. Even more strangely, when this occurs, if I change that "huge number" (say remove or add a zero), it works..! I've come to the point that for now, I decided to generate a random number between 10^10 and 10^11 for the LIMIT, and it has been working alright so far, but you can easily see how this isn't a long-term solution :)

Here's a excerpt of the code I use:

http://pastie.org/820108

and the query:

http://pastie.org/820114

Remark: on that particular query, it works without the "LIMIT" or by adding a zero to it for instance.....!

If anyone ever encountered a similar problem and would be nice enough to let me know if I do something wrong, that'd be really helpful!!
Thanks,

Anthony


-------


I should also add that the query seems to function from MySql terminal, so the problem would come from mysql's JDBC driver

Options: ReplyQuote


Subject
Written By
Posted
blocked resultSet.next()
February 11, 2010 11:40AM
February 12, 2010 12:46AM
February 12, 2010 09:52AM


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.