poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chang, Carlos" <CCh...@northropgrumman.com>
Subject Cannot Write Excel File
Date Wed, 05 Feb 2003 18:47:45 GMT
All,

I have a bean (part of an J2EE app) that generates an Excel file just fine
when I run it from laptop (on Win2K pro) , but when I deploy it to our
staging server, running on WebSphere app server 4.x and  Solaris 9.x OS, it
doesn't write the file out, can someone tell me what I'm not doing correctly
and how to fix it?

Below is the java file (of course strip down):
****************************************************************************
*************************************
package com.ngit.iis.scus.classes;

// imports 

public class ExtractAllCSISEvents
{
	// Private variables
	
		/* CONSTRUCTOR */
	public ExtractAllCSISEvents()
	{
		// Something
	}

	public void doExcelSheet(HttpServletRequest request, ServletContext
context) throws SCUSException
	{
		// Variables

		try
		{
			Connection conn = null;
				
			try
			{
				File excelFile = new
File(request.getParameter(ExtractToExcel.FILE_NAME));
				FileOutputStream fileOut = new
FileOutputStream(excelFile);
				
				String fromDate =
request.getParameter(ExtractToExcel.FROM_DATE_NAME);
				String toDate =
request.getParameter(ExtractToExcel.TO_DATE_NAME);
        				
				HSSFWorkbook wb = new HSSFWorkbook();

				HSSFSheet sheet = wb.createSheet("Metrics");

				HSSFRow row = null;

				HSSFCell cell = null;

				
				HSSFFont font = wb.createFont();

				font.setBoldweight(font.BOLDWEIGHT_BOLD);

				HSSFCellStyle cellStyle =
wb.createCellStyle();			
	
cellStyle.setDataFormat(HSSFDataFormat.getFormat("m/d/yy"));

							
				/* ESTABLISH THE CONNECTION */
				conn = ((ConnectionEstablisher)
context.getAttribute("connEstablisher")).establish();
								
				/* SELECTING RECORDS FROM ORACLE FOR
DOWNLOAD */
				String queryStmt  = "SELECT ...";
	
				while ( queryRS.next() )
				{					
					//  Looping thru result set

				}
		 		
				/* CLOSE PREPARED STATEMENT */
				psQuery.close();
				queryRS.close();
    			
    			/* WRITE THE EXCEL FILE & CLOSE THE fileOut */
	    		wb.write(fileOut);
	    		fileOut.close();				
				
			}
			catch ( ConnectionNotMadeException cf )
			{
				throw new SCUSException(cf.getMessage());
			}
			catch ( FileNotFoundException fnfe )
			{
				throw new SCUSException(fnfe.getMessage());
			}
			catch ( SQLException se )
			{
				/* CHECK FOR BASIC ERROR MESSAGE */   
			}
			catch ( ParseException pe )
			{
				throw new SCUSException(pe.getMessage());
			}
			finally
			{				
				/* CLOSE CONNECTION */
			}
		}
		catch ( SCUSException se )
		{
			throw new SCUSException(se.getMessage());
		}
		catch ( IOException ioe )
		{
			throw new SCUSException(ioe.getMessage());
		}		
		
	}

}

Thank you,
Carlos



Mime
View raw message