Prev: How to learning java without pay money?
Next: is it possible to call 32 bit shared libraries on 64bit os platforms?
From: tomo on 23 Apr 2010 10:00 I have a web application, and I want to load a xls file from db (blob). How can i do it, without using something like File file = new File(C:\...)... Only restriction is that I can't use some hardcoded folder(for example c:\file) to create let's say a new xls. file, it has to be some temp file on server ? __________ Information from ESET NOD32 Antivirus, version of virus signature database 5052 (20100423) __________ The message was checked by ESET NOD32 Antivirus. http://www.eset.com
From: Lew on 23 Apr 2010 10:39
tomo wrote: > I have a web application, and I want to load a xls file from db (blob). How > can i [sic] do it, without using something like File file = new File(C:\...)... > Only restriction is that I can't use some hardcoded folder(for example > c:\file) to create let's say a new xls. file, it has to be some temp file on > server ? > It needn't be any kind of file anywhere, given that it's already a file in the DB, from what you tell us. BLOBs map to 'byte[]' and can be accessed via 'InputStream'. <http://java.sun.com/javase/6/docs/api/java/sql/ Blob.html#getBinaryStream()> You probably want Apache POI. <http://poi.apache.org/> <http://poi.apache.org/spreadsheet/index.html> It has ways to create an XLS document from 'InputStream'. <http://poi.apache.org/apidocs/org/apache/poi/xssf/usermodel/ XSSFWorkbook.html#XSSFWorkbook(java.io.InputStream)> <http://poi.apache.org/apidocs/org/apache/poi/ss/usermodel/ WorkbookFactory.html#create(java.io.InputStream)> |