java.lang.OutOfMemory error when fetching records from Database

Posted by Nisarg Mehta on Stack Overflow See other posts from Stack Overflow or by Nisarg Mehta
Published on 2010-03-19T13:23:00Z Indexed on 2010/03/19 13:31 UTC
Read the original article Hit count: 457

Filed under:
|

Hi All,

When I try to fetch around 20,000 records and return to ArrayList then it throws java heap space error.

   JdbcTemplate select = new JdbcTemplate(dataSource);
            String SQL_SELECT_XML_IRP_ADDRESS = " SELECT * FROM "+ SCHEMA +".XML_ADDRESS "+
                                                    " WHERE FILE_NAME = ? ";
            Object[] parameters=new Object[] {xmlFileName};
            return (ArrayList<XmlAddressDto> ) select.query(SQL_SELECT_XML_ADDRESS,
                    parameters,new XmAddressMapExt());

Is there any solution for this ? How should i process this effectively ?

© Stack Overflow or respective owner

Related posts about java

Related posts about jdbc