This discussion is archived
0 Replies Latest reply: Aug 24, 2007 8:58 AM by 807605 RSS

Which is efficient? (DB Connection and File Handling)

807605 Newbie
Currently Being Moderated
Hi,
I need to download a file(CSV file of some 100-200 KB) on click of a button in JSP.
The contents of the file is also displayed in the JSP (say page1.jsp)in formatted way so that user can print the details instead of download.

1st approach:

before coming to page1, connect to DB(Oracle DB, using JDBC Connection pooling) and get all the details required to display (which will be same as the contents of file). Store the details collection framework classes. Also create a CSV file and store it at some location. On click of Download button in JSP download the stored file (Here I am again going to servlet before downloading).

2nd approach:

before coming to page1.jsp, connect to DB and get the details required to display in the screen but don;t create any file. On click of download again connect to DB and get the details, create the file and download it.

Please let me what are the merits and demerits of the above mentioned approaches.
Thanks in Advance.

Arun.K.