Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

outOfMemory

 
Elizabeth Chen
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I need to query a huge database table in order to caculate data into a Vector, everytime, I execuate the sql:
select * from JobInfo startTime > t1 and endTime <= t2
The database could return more than a lot of entries if (endTime - startTime) is greater than 1 month and generate outOfMemory exception.
I used mm.mysql JDBC which doesn't support setFetchSize.
Anyone has suggestion?
 
Robert Brunner
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, if you are getting a java exception, I would suggest increasing the size of the your JVM's heap memory (Remember the JDBC driver runs in your client JVM). The details are somewhat JVM specific (RTFM), but for the SUN JDK, you would use the -X non-standard JVM features (type java -X for a listing of them). Here are the ones you want to check with.
-Xms<size> set initial Java heap size
-Xmx<size> set maximum Java heap size
Another thing you should probably keep in mind (note I know nothing about your table schema) is don't do a SELECT * as it will return everything. If you only need a few columns, it is much better to be selective and pick only the ones you need. Another option is to get a count first of the number of rows which meet your query.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic