where pstm is an object of prepared statement and select query is the query to retrieve the data from the database.
I am getting outofmemory exception due to limited heap size.
So i want to retrieve the result in a stream so i tried to set
but as this method says it is for defining the number of rows to be retrieved but i want to define the number of megabytes to be retrieved because it may be my one row have vaery large data so it may be the scene that only two rows create the same problem.
Most people use paging to specify the number of records. What type of field do you have that returns such large data? A BLOB/CLOB? If so, maybe you want to get all the other fields and the very large field one at a time?
What are you doing with megabytes of data from a single row multiple times?