• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

outOfMemory

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic