• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JDBC connection hangs at executing rs.next()

 
Marc Juarez
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to read from a mySQL server (in my LAN) a huge resultSet. I implemented it the way I found looking for the setFetchSize method. So I did:



Although, it hangs retrieving the row 1077 of the DB, at the line of the rs.next(). It doesn't throw exception.

Any idea?

Thank you!
 
Wendy Gibbons
Bartender
Posts: 1111
Eclipse IDE Oracle VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the ranch Marc.

Is any of the data you are retrieving large?

and have you tried playing with the fetch size making it smaller?
 
Marc Juarez
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you, Wendy!

Wendy Gibbons wrote:
Is any of the data you are retrieving large?


Do you mean the data in the columns? Yes, there is a column that contains a long description of a pair of sentences, the other columns are an URL and a directory path)


Wendy Gibbons wrote:
and have you tried playing with the fetch size making it smaller?


I think that for JDBC MySQL this is the only possible value for the setFetchSize. According to the MySQL driver documentation there are only to options: (i) Integer.MIN_VALUE -> row-by-row (ii) 0 -> whole result (default)
 
Wendy Gibbons
Bartender
Posts: 1111
Eclipse IDE Oracle VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
do you have a stupidly small program that simply connects to the database, gets the data (as supplied) and disconnects?

as I have seen mysql-> JDBC handle much more data than this before.
 
Marc Juarez
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wendy Gibbons wrote:do you have a stupidly small program that simply connects to the database, gets the data (as supplied) and disconnects?


Yeah, I do. The code that I wrote in my first post does that. Connects tries to get the data (row-by-row) and disconnects. Otherwise, if I try to do it without the setfetchsize, JVM runs out of memory because is a large database.

Wendy Gibbons wrote:as I have seen mysql-> JDBC handle much more data than this before.


I didn't understand that, sorry. What do you mean?
 
Wendy Gibbons
Bartender
Posts: 1111
Eclipse IDE Oracle VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ahh do you have any jvm memory settings? this stuff: -Xms1028m -Xmx1028m.

 
Marc Juarez
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Wendy,
I've tried and it happens exactly the same.
 
Wendy Gibbons
Bartender
Posts: 1111
Eclipse IDE Oracle VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can you post the whole program, as I have no other ideas based on the snippet you have provided.
and some example data
 
Habeeb Shaikh
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Marc ,
do some changes in program for better memory management.
1. Declare these 2 string variable outsite while loop.
2. after reading values set both string variable as null like. rsc=null.

Try it. Hope it will over come memory overflow problem.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic