Thread: extracting data

    #1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2002
    Posts
    0
    Rep Power
    0

    Unhappy extracting data


    I want to extract files from my database so my administrator can view these files. The files can be either images or .doc's. Does anybody have any ideas how i could do this.
  2. #2
  3. No Profile Picture
    Java Developer
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2001
    Posts
    5
    Rep Power
    0
    Hi,

    You can store them as blobs (binary large objects) or clobs(character large objects), if your database will support them. Though you can't treat them the same as you would other data that you insert/retrieve from a db, you instead have to get a reference to them from the db and use a (input/ouptut)stream to write/read from them.

    Once you've got them you can stream them to the client on the servletOutputStream, and set the contentType to the relevant type (must be done before opening the stream if I remember rightly though).

    Is this the kind of answer you were looking for?

    This isn't pretty, and if you can avoid it I would. If it is secure you could always use the db to store the file name and path, then just redirect a browser to the specified file. Clobs and Blobs are as far as I'm aware not even stored in the main db, they are more like pointers to files that external to the db

    Oscagne

IMN logo majestic logo threadwatch logo seochat tools logo