Retrieve Binary File stored in DB

Hello,
I am able to store PDF, MS word, MS Excel files as Binary files to MS Sql Server 2008.
How do I retrive these files on the view page.
I need to hyperlink the files, so when User clicks it opens or prompts for download.

Well... they hyperlink should go to a CFM file which queries the DB for the file content then outptus that with the correct MIME type set for the file in question.
However getting CF to do this is a really inefficient approach to such things: you're gonna want to keep an eye on what percentage of your CF threads get tied up serving files like that.
Is there any reason you can't serve the files from the file system, rather than from the DB via CF?
Adam

Similar Messages

  • Link to binary file stored in CMS?

    Hello,
    <p>I'm using WebLogic Portal 8.1 SP5 and storing PDF & DOC files as assets in the WebLogic CMS. I'm trying to present links to these files in a portlet (pageflow). I'm currently using the following tags to display the links but am having some difficulty.</p>
    <p><b><cm:getNode path="/BEA Repository/Folder/SomeFile" id="node"/>
    <ad:render id="node"/></b></p>
    <p>I've also tried using a placeholder but had the same behaviour.</p>
    <ol>
    <li>The a href text is always "/BEA Repository/Folder/SomeFile". Is it possible to customize this? I'd like to display the file title</li>
    <li>The a href URL is /BEA+Repository/Folder/SomeFile. Is it possible to have the URL be the same as the binary file that's stored in the CMS or do I have to explicitly set the asset's name the same as the file itself?</li>
    </ol>
    <p>
    Thanks,
    </p>
    <p>Cotter</p>

    If you want to create a link to the file in the repository, I suggest you use the ShowBinaryServlet.
    From javadoc...
    public class ShowBinaryServlet
    extends ShowPropertyServlet
    Writes a Binary property of a Node to the response OutputStream. The available paramater options are as follows:
    # 1) Pass the node Id in as a request parameter. Eg. http://server:port/app/ShowBinary?nodeId=/repo/12345.
    # 2) Pass the node path as part of the the request pathInfo. Eg. http://server:port/app/ShowBinary/repo/path/file.ext.
    # 3) Pass the node path in as a request parameter. Eg. http://server:port/app/ShowBinary?nodePath=/repo/path/file.ext

  • Transfer a binary file stored in a table field in oracle to another table different schema in oracle

    I would like to know if it is possible to use ssis to transfer a binary file of a datatype of long raw in a field in one table in oracle to a new table in a different schema of a datatype blob in oracle? The binary file is a Crystal reports executable
    which is used in a application that I support. I are trying to consolidate data fields over many schemas into one main schema to simplify the support issues.

    Hi r_peterser,
    SQL Server Integration Services maps DT_IMAGE data type to LONG RAW and BLOB in Oracle. So, you can directly use an OLE DB Source or Oracle Source adapter to extract the LONG RAW column from the Oracle database, and then load the data to the BLOB column
    of the Oracle table through an OLE DB Destination or Oracle Destination adapter.
    Reference:
    http://technet.microsoft.com/en-us/library/ms141036.aspx 
    Regards,
    Mike Yin
    If you have any feedback on our support, please click
    here
    Mike Yin
    TechNet Community Support

  • Retrieving MP3 files stored on iPod

    The external drive I use to store my music and iTunes crashed.Is there anyway to retrieve these files from my iPod ?
    (30Gig Video)
    Thanks
    DELL Lattitude D819   Windows XP Pro  

    There is a manual method of accessing the iPod's hard drive and copying songs back to iTunes on Windows posted in this thread: MacMuse - iPod to iTunes
    If you prefer something more automated then there are a number of third party utilities that you can use to retrieve the music files and playlists from your iPod, this is just a selection. Have a look at the web pages and documentation for these, they are generally quite straightforward. As iTunes 7 is just out some of these may not have caught up with it yet though I haven't experienced any problems with the Mac software I use.
    YamiPod Mac and Windows Versions
    iGadget Windows Only
    iPodCopy Mac and Windows Versions
    iPod Access Mac and Windows Versions
    PodUtil Mac and Windows Versions
    iPodCopy Mac and Windows Versions
    PodPlayer Windows Only
    CopyPod Windows Only
    There is also a new function in iTunes 7 under File, "Transfer Purchases from iPod" which transfers iTMS purchases. A paragraph on it has been added to this article: How to use your iPod to move your music to a new computer

  • RETRIEVE OF ETXT FILE STORED IN BLOB

    Hi,
    I have a question on utl file. I wrote some text in an utl file (text file) and stored it as blob in data base at back end while my team mate has to retrieve the data stored in blob in front end using java. when he retrieves, the file which i stored as blob is retrieved as html file not as text file i stored initially . when we retrieve a file stored as blob, how a blob file will be retrieved..is it depends on front end programmer or is there any format where a file stored as blob will be retrieved only on that format? Kindly give your expertise on this question

    As Billy said, the passing through correct mime type is the only reliable way. If you have already loaded tons of blobs without providing this information, you may try a small workaround to determine the right mime type for your files by emulating the file utility behaviour in the database - you have to load the /etc/mime-magic or something similar for your os into the database and then compare certain bytes of your lobs with those recorded in the mime-magic file. An example how it can be done is here
    http://articles.techrepublic.com.com/5100-9592_11-5219073.html
    You could so complete the missing information in the database without to unload your data , but you should be aware - this can not replace the need to provide right mime type information by loading into database.
    Best regards
    Maxim

  • When I do a download, it is saved to a Binary File. Where are these files stored & how do you uninstall a program you don't want to keep ?

    I use firefox, when I download a file from another website, there is a pop-up that shows the name of the download, which shows it is saved to a binary file, (don't know what a binary file is) but my question is where are the binary files stored on my computer & if I can uninstall it if I don't want to keep it.

    read basic about svchost:
    [http://support.microsoft.com/kb/314056/en-us A description of Svchost.exe in Windows XP Professional Edition]
    find svchost services:
    [http://webcache.googleusercontent.com/search?q=cache:pa9PdGlHr0sJ:www.bleepingcomputer.com/tutorials/list-services-running-under-svchost.exe-process/+what+is+svchost.exe&cd=12&hl=el&ct=clnk&gl=gr a way how to determine what services are running under a SVCHOST.EXE process]
    One Temporary Solution is to disable the Windows Automatic Update service:
    http://ask-leo.com/how_do_i_fix_this_high_cpu_usage_svchost_virus_or_whatever_it_is.html
    (no '''it is not''' a virus)
    (works for me)
    thank you
    Please mark "Solved" the answer that really solve the problem, to help others with a similar problem.

  • Storing data in  tablemodel to a binary  file

    hi,
    i have a program that uses AbstractTableModel with Jtable....I need to store data in a file when the program closes... i heard that there is a way to some how convert data in Tablemodel to a binary file and retrieve data from the binary file...other then storing it in a text file and parsing the data. So can anyone help me?
    Thanks

    You can loop through the data in the table and Serialize the data using object serialization.
    Simply implement the java.io.Serializable interface. Then use this code for serizlizing the data. Note that to serialize data, it must be an object not primitive types.
    serialize to a binary file
    try
        ObjectOutputStream os = new ObjectOutputStream(new FileOutputStream(new File("datastore.ser")));
        os.writeObject(<your data from table>);
        os.flush();
    catch (IOException ioe) { ioe.printStackTrace(); }
    reconstructing the object from binary file
    try
        ObjectInputStream is = new ObjectInputStream(new FileInputStream(new File("datastore.ser")));
        obj = (<data type of Object>) is.readObject();
    catch (IOException ioe)
        ioe.printStackTrace();
    }Hope this helps,
    Riz

  • Should heavy binary files be stored in database?

    I was asked an interesting question: Should a database contains all data? Or heavy binary files should be stored in file system?
    Example of heavy binary files : videos or heavy pdf files (+200 MB).
    With an old aspx web app (1.1) I tried to open a 200MB pdf file stored as a blob in an Oracle 11g database, and it just run out of memory.
    However, same asp.net web application had no problem to open same pdf file stored in file system of a server. It could be that maybe there is some proper way to open heavy blobs fields with asp.net.
    For integrity reasons, I say that all data should be stored in database, but my described case showed me that maybe it's not the way.
    SQL Server allows the contents of varbinary(max) columns to be stored on the file system, maybe there is something similar in Oracle?

    user521219 wrote:
    With an old aspx web app (1.1) I tried to open a 200MB pdf file stored as a blob in an Oracle 11g database, and it just run out of memory.Because it likely tried to read, and cache, the entire BLOB. Instead of reading and streaming BLOB chunks to the (web browser) client.
    However, same asp.net web application had no problem to open same pdf file stored in file system of a server. It could be that maybe there is some proper way to open heavy blobs fields with asp.net.So now blame Oracle for the inability of an ASP/.Net programmer to stream file contents correctly, but not LOB contents?
    SQL Server allows the contents of varbinary(max) columns to be stored on the file system, maybe there is something similar in Oracle?You want Oracle to be like SQL-Server? Oracle does a poor SQL-Server imitation. It plays the role of being Oracle, technically the most advance relational database management system available, excellently.

  • Storing data in binary files

    I am trying to store my data in binary files to save space and lessen time spent on hard disk reads. However, I can't seem to find the proper way to do this in java.
    For example, I have the integer 65535 in java. How do I convert it into a 2 byte string FF FF in java?
    When I read 2 bytes FF FF to a string from a binary file, how do I interpret it as a -32767 or a 65535 ?
    Sorry if this seems like a really obvious question. None of the integer or string methods in java seems to do what I want :(

    If all you want is a compressed file, you might want to use java.util.zip.GZIPOutputStream, and send it data in a simple format (like XML) rather than trying to compress everything to bytes yourself.

  • How to read a binary file written in LabVIEW 6.1 using VB ?

    How to read a file saved in binay forrmat in LabVIEW 6.1 platform through VB.
    Is there any code ?
    Thanks

    Hello,
    LabVIEW files stored in binary can take on just about any format that
    you choose, so there will not be a single piece of code that will give
    you what you are looking for.  You can use VB's standard file
    operation functions to read in a binary file created by LabVIEW, just
    as you would read in any other binary file.  See this page
    on Microsoft's web site for more information on the binary file read
    operation.  How you stored the data in the binary file will
    determine how you need to extract it from the byte array.  So, if
    the first element stored in the file was a 32-bit integer, you could
    extract an int from the byte stream to recover that piece of your
    data.  You would need to know in advance how the file was
    formatted in order to successfully retrieve the information.  If
    you need a reference for the VB functions, the microsoft link above
    will get you to some good information.
    Cheers,
    Matt Pollock
    National Instruments

  • Binary file text file

    I need to read binary file (actualy text file was saved in binary format) and convert to text file. After finished program, I must store this text file to binary format for use in next time. Anyone have any idea or suggestion will be usefull and great thanks

    I need to read binary file (actualy text file was
    saved in binary format) and convert to text file.
    After finished program, I must store this text file
    to binary format for use in next time. Anyone have
    any idea or suggestion will be usefull and great
    thanksLook, every bit of text stored in a computer is stored in a binary format. The familiar ASCII bytes format is merely the most common of them. But, to the filing system, it's just another binary file.
    Java deals with many different ways of encoding text as binary. Mostly these are called "character encodings". The second most common one is UTF-8 which stores non-latin chacters as multi byte sequences. Also java can store and retrieve text from mixed file formats in which only part of the data is text.
    You'll get nowhere unless you can find out what binary format the text is stored in.
    In general java handles binary using Stream objects and text using Reader and Writer objects.

  • Retrieving Blob files

    I have a SQL Server 7 database where files are stored as blob.
    Now I want to retrieve the files so i created a java program. I can retrieve the files, but when I open them (I saved them as txt) there unreadable.
    Then I found that in the text the type of document is specified. So I did a renaming. after this I'm able to open PDF files but word or excell files are still unreadable.
    does anybody have excperience with this?
    This is het part of the code used to extract the files.
    void getBinaryFileAttachment(String FileName,ResultSet rs) throws IOException, FileNotFoundException, SQLException
              //Array to hold array of file bytes
              byte[] fileBytes; //an array of bytes
              byte buf[] = rs.getBytes(1);
              System.out.println(buf);
              String ext = "";
              OutputStream targetFile;
              //Create and write the tempfile
              OutputStream tempFile=  new FileOutputStream("Temp.dat");
                tempFile.write(buf);
              tempFile.close();
              File f = new File("Temp.dat");               
              FileReader fr = new FileReader(f);
              BufferedReader br = new BufferedReader(fr);
              String meta = br.readLine();
              if(meta.indexOf(".pdf") != -1)
                   System.out.println("PDF File detected");
                   ext = ".pdf";
              else
              if(meta.indexOf("Word.Document.8") != -1)
                   System.out.println("Doc File detected");
                   ext = ".doc";
              else
                   ext = ".txt";
              fileBytes = rs.getBytes(1); //create a byte array from contents of field
              targetFile =  new FileOutputStream(FileName+ext); // define the output stream 
              targetFile.write(buf); //write the array of bytes to file
              targetFile.close(); //close the File stream
         }

    Documents saved through the OEL container type in Client Server are saved as serialised objects in the database - e.g. the thing the DB is not a binary copy of the document on disk, but a memory representation.
    WebUtil on the other hand - saves any file to the DB as a binary copy of the O/S file and likewise any file it pulls out will be an exact copy of what is in the DB.
    In the case of using WebUtil to pull out a document that was saved through an OLE container this will not work because the file on disk that WebUtil produces will not be the same as the source document.
    At some point we'll be writing a utility to de-serialise the OLE document that is Stored by OLE containers in a blob to restore them to file form on disk.
    You can of course do this manually by writing a Form (in 6i client server) which queries the blob into an OLE container and then uses OLE to call the Save method of the OLE server to pull the document onto disk.
    HTH

  • Reading an object from a binary file

    i am writing objects into my binary file using printwriter class. i am able to write objects into the file but i am having problems reading the object from the file. is there any other way of going about it. i tried using the objectoutputstream and object input stream class. but i am getting run time errors coz of something to do with serialization
    i am storing records as a object into a binary file so that it is easy to seek my records

    Of course you have trouble reading objects after you wrote them with a PrintWriter.
    You should rather have fixed the Serialization errors: only objkects that implement Serializable correctly can be serialized.

  • How can I open different binary files from BLOB column ?

    If we store some type of binary file (XLS, DOC, PDF, EML and so on, not only pictures) in BLOB column how can I show the different contents? We use designer and forms 9i with PL/SQL.
    How can I copy the files from BLOB to file in a directory or how can I pass BLOB's content to the proper application directly to open it?

    The mime type is just a string as explained above (e.g. application/pdf...). There are lot of samples here and on metalink.
    E.g. add a column mime_type varchar(30) to your blob table. Create a procedure similar to the following:
    PROCEDURE getblob
    (P_FILE IN VARCHAR2
    IS
    vblob blob;
    vmime_type myblobs.mime_type%type;
    length number;
    begin
         select document, mime_type into vblob,vmime_type from myblobs where docname = p_file;
         length := dbms_lob.getlength(vblob);
         if length = 0 or vblob is null then
         htp.p('Document not available yet.');
         else
         owa_util.mime_header(vmime_type);
         htp.p('Content-Length: ' || dbms_lob.getlength(vblob));
         owa_util.http_header_close;
         wpg_docload.download_file(vblob);                
         end if;
    exception
         when others then
         htp.p(sqlerrm);
    END;
    Create a DAD on your application server (refer to documentation on how to create a DAD).
    Display the blob from forms (e.g. on a when-button-pressed trigger):
    web.show_document('http://myserver:port/DAD/getblob?p_file=myfilename','_blank');
    For storing blobs in a directory on your db server take a look at the dbms_lob package.
    For storing blobs in a directory on your app server take a look at WebUtil available on OTN.
    HTH
    Gerald Krieger

  • How to extract the contents of ZIP file stored in oracle database column ?

    The file is in ZIP format and it is stored in BLOB databse column . The contents of file is in binary format .
    How to extract those contents from file and thus creating the same ZIP file as output in ODI ?
    Thanks
    Arun

    Perhaps you can something like what is described in the support note "How To Load A PDF File Or Other Binary Files To a BLOB Column From ODI (Doc ID 1412753.1)"

Maybe you are looking for

  • How to Disable OWA 2013 Mobile View

    Hi, I've the Exchange Servers 2013 CU6 at my environment. If I access OWA from mobile, default owa view is auto changed to narrow view. May I know how can I disable the OWA Mobile View and set all session to desktop view? Thanks & Regards, Nay Lin  N

  • How does the ituns app on my ipad2 work?

    How does the itunes app on my 1pad2 work?

  • How do I get LR to associate pictures with current PS install

    If I look in an older folder of pictures and choose one that had already been edited in PS and I decide to again edit it Photoshop, it will look to my backup hard drive and start that PS even if I have the current PS from my main HDD running.  How do

  • Getting Kernel Panics every time I shutdown Need Help!

    It boots fine, AHT says hardware is ok, and runs like normal but the minute I shutdown it Kernels any help will be greatly appreciated. Here is the report: Interval Since Last Panic Report:  54984 sec Panics Since Last Report:          12 Anonymous U

  • Org.flexunit.listeners.UIListener not found, and other problems

    I have a basic setup of FlexUnit that comes with the latest FlashBulider. I import a bunch of SWC's in my project and try to follow instructions from here: http://docs.flexunit.org/index.php?title=Setting_up_a_FlexUnit_4_Project I got an error saying