I have uploaded a csv file into database as a byte[] data, using hibernate and spring, I have 3 columns in my database (id, file name and byte[] data). I would like to display the 3rd column which is a csv file, into a front page. Any help?
Asked
Active
Viewed 79 times
0
-
Why? Why not upload the CSV file into a table containing its constituent columns? – user207421 Apr 19 '16 at 03:37
-
I thought is was possible, but it seems a bit messy, I will try to upload the csv into a table. thanks. – Jessica Apr 19 '16 at 08:51
1 Answers
0
From the database perspective, this is nothing more than querying the table by ID and reading the BLOB from the database.
The tricky thing is that unformatted BLOBs/CLOBs are usually read using streams of some sort, and rarely are available as straight columns. Depends on your database implementation, hibernate can sometimes hide the complexity, but something to watch out for.
In terms of displaying it, it's a matter of using the returned BLOB and throwing it into something to force it to display. A quick search found this, but this is really the more difficult part of the problem, the database side can be fairly boring here.

Scott Sosna
- 1,443
- 1
- 8
- 8