It's not a secret anymore!*
The moose likes JDBC and the fly likes How to use ResultSet Object Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "How to use ResultSet Object" Watch "How to use ResultSet Object" New topic
Author

How to use ResultSet Object

fazul kareem
Greenhorn

Joined: Jan 24, 2006
Posts: 2
I am currently working on bringing out some nice plots.To be pricise, i am using jfreechart .The user can input from and to dates and that could be even as long as one year or sometimes even 2. In such cases i will have to work with data of the order of (40,000 * 12) rows from the database say for one year..and each row will contain 5 columns..Column 1 is TimeStamp and rest are floats...
In such cases what is the best possible way to go about..I first tried taking the whole data in a resultset.Then i realised that accessing such huge ResultSet object thro rs.get() becomes slow.Then i tried first getting the whole data in resultset and then dumbing it into a 2D array.This made things faster to some extend..But i am confused ? is this the right way? or is there another better way of doing this?

please help me guys..pleeeaazzzzzzzee!! []
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14074
    
  16

Do you really need all the 40,000 * 12 = 480,000 records to create your chart? Think about what data is really needed to create the output you need, and find out an SQL statement that fetches only the data you need.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to use ResultSet Object
 
Similar Threads
Try/Catch/Return
Class that returns Mysql Data?
Date not fully replaced by Calendar?
Lots of Data :: Out of Memory
which is better resultset ->xml+xsl-> html or resultset->list-> jsp performance wis