• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Launching a file stored in an Oracle db from a web app

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is my situation.
In my Java web app, we have a form that allows the user to attach any type of document. I take that attachment and store it in a BLOB column in an Oracle database. I have taken care of this no problem.
What I need to know is how do I create a link on the web page that will allow the user to click the link and have the attachment in the Oracle database launch?
Do I have to temporarily put the attachment in a directory on the server and launch it from there? (and if so how do would I go about launching that file? )
or is there someway to read the file into an input stream or something like than and then have it launch..
I am quite new to Java and am having difficulty with this pblm. Any help is greatly appreciated!
Thank you in advance,
Bruce Demspsey
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Bruce,
Welcome to Java Ranch!
You'd want to have a Servlet which accepts information about where the document is stored as a parameter. Then, in the web page you'd put a hyperlink to that servlet .. i.e.,
http://myserver/myservlet?table=ATABLE&column=ACOLUMN&document=foo.doc
Youmight have to include more information so that the servlet could find the document in the database, but you get the idea.
Then the servlet would send the contents of the BLOB as its output. If the servlet sets the MIME type of its output to something appropriate for the document -- i.e., "application/msword" for word documents -- then it's up to the client web browser to take the data and launch the proper application to view it.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic