Link to home
Start Free TrialLog in
Avatar of boopathi s
boopathi s

asked on

I created an Xlsx export using cold fusion.It throws the following Errors 1.java heap space,GC overhaed limit and Software caused connection abort: socket write error.

This is my Piece of code:
      // Procedure to get results
     <cfquery name="ExportData" datasource="#session.DataSource#">
                  EXEC xxx 6, #yy#,'#Dateformat(now(),'mm/dd/yyyy')#','#StartDate#', '#EndDate#', #rx#, NULL
   </cfquery>

This procedure gives the result set more than 1 lakh records.From this I formed the 'QoQ' from the above procedure.

'Query of Queries to get result set'

   <cfquery name="Residents" dbType="query">
                  SELECT ContactID, State, Location, Name, MIDate, MODate, MoveOutReason, MovedToDesc, DateOfBirth, Race, Gender, FirstTotalPts, LastTotalPts
                  FROM ExportData
                  WHERE SectionIND = 'Residents'
            </cfquery>

    <cffunction name="QueriesToXLS" access="public">
    <cfargument name="queryArr" required="true" /><!--- An Array of Query Objects --->
    <cfargument name="sheetNameArr" required="false" /><!--- Optional sheet names to use instead of "Sheet1","Sheet2",... --->
    <cfset tempPath = GetTempDirectory() & CreateUuid() & ".xlsx" /><!--- Creaete a Temp XLS File --->
    <cfset counter = 1 />
    <cfloop array="#ARGUMENTS.queryArr#" index="i">
        <cfset sheetName = "Sheet#counter#" />
         <cfif isDefined("ARGUMENTS.sheetNameArr")>
            <cfset sheetName = ARGUMENTS.sheetNameArr[counter] />
        </cfif>
        <cfspreadsheet action="update" filename="#tempPath#" query="i" sheetName="#sheetName#" />
        <cfset counter += 1 />
    </cfloop>
    <cfreturn SpreadsheetRead(tempPath) />
    </cffunction>

// function to form xlsx file --
<cfset xlsData = QueriesToXLS(
                  [Residents, x,y,z,a,f],
                  ["Residents", " x","y","z","a","f"]) />

If I runs the Procedure for smaller date range it gives the excel file.When runs for larger date ranges for example 13 thousand records it throws the above mentioned errors?How to overcome these errors.Please help me out on this.
ASKER CERTIFIED SOLUTION
Avatar of boopathi s
boopathi s

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of _agx_
_agx_
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
"Update" uses more memory than spreadsheet functions.