Solved

reading uploaded excel blob

Posted on 2007-12-06
7
2,030 Views
Last Modified: 2010-04-21
i have an excel file uploaded in oracle DB as BLOB.

I want to read that excel file.

In order to that . i first wrote a method which returns a byte[] of the uploaded BLOB file


public byte[]  getFile(String rowid)  // this  returns the uploaded excel file in byte array.


Now how do i use this byte[] to read the content of the excel file ?


My excel file is like this..

http://docs.google.com/Doc?id=dcbk3w7_3mprg2v

I want to read its content.
note there is a gap between  year and description.

how do i solve ?



0
Comment
Question by:cofactor
  • 3
  • 2
  • 2
7 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 20419110
Make it the argument to the construciton of a ByteArrayInputStream and then read that stream with an Excel API
0
 

Author Comment

by:cofactor
ID: 20419139
thanks for the comment.

can you please provide me a link of a standard code  which reads  excel file using POI .
i used POI earlier....unfortunately i lost the standard code.

see, i have integer cell as well as String cells in the content....so cell checking and reading is also important.

My another concern is , there is big gap between year and description.


However, i would appreciate , if you please forward me a link which shows how to read using POI.
0
 
LVL 86

Accepted Solution

by:
CEHJ earned 500 total points
ID: 20419231

InputStream myxls = new ByteArrayInputStream(blobBytes);

HSSFWorkbook wb     = new HSSFWorkbook(myxls);

Open in new window

0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 92

Expert Comment

by:objects
ID: 20424029
don't convert your blob to a byte array (its unecessary and inefficient), just return the blob stream directly

public InputStream  getFile(String rowid)  // this  returns the excel stream.

you can then use:

HSSFWorkbook wb     = new HSSFWorkbook(getFileStream(rowid));
0
 
LVL 92

Expert Comment

by:objects
ID: 20424038
or using the blob directly:

HSSFWorkbook wb     = new HSSFWorkbook(blob.getBinaryStream());
0
 

Author Closing Comment

by:cofactor
ID: 31413126
excellent
0
 

Author Comment

by:cofactor
ID: 20458782
Thanks CHEJ ,i was looking for that exactly.

Thanks Object, that was also a good solution .but i  have been provided the byte[]  array in fact.
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
hash value 2 39
parentbit challenge 3 52
pairs challenge 5 45
GUI builder for Eclipse? 8 14
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now