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

Similar Messages

  • How to retrieve blob file

    i am having a problem retrieving my blob file(PDF) to display on browser.
    i have this code below:
    $filename = $row['FILENAME'];
    // Call the load() method to get the contents of the LOB
    print $row['BINFILE']->load()."\n";
    header('Content-type:application/pdf');
    //header("Cache-Control: private",false); // required for certain browsers
    header('Content-Disposition: attachment; filename="'.$filename.'"');
    readfile($filename);
    echo $row['BINFILE'];
    this will display some characters when opened at mozilla. when opened on IE, this doesn't display pdf on the browser instead it will only allow to save the file.
    hope anyone can give me some advice n some assistance on this.
    thanks
    Edited by: tamse on Jul 7, 2009 7:16 PM
    Edited by: tamse on Jul 7, 2009 7:19 PM

    I've got an example on my blog that might help, it's using a PNG. You can find it here:
    http://blog.mclaughlinsoftware.com/php-programming/oracle-lob-processing/

  • DBMS_LOB retrieve jpg files from Blobs

    Help me, please
    I have some application on ORA9.2.01 , and I'm using a DBMS_LOB package for storing jpg filon WIN200 Adv.Server as BLOBS. When I tried to retrieve those files using UTL_ .. package , as is in literature recommended , I obtained in every case non identical , or damaged greater files than originals.
    Help me , please with this my problem.
    Thousand thanks. Jarda.
    When You are so kind to help me , send please Yor response to [email protected]

    Help me, please
    I have some application on ORA9.2.01 , and I'm using a DBMS_LOB package for storing jpg filon WIN200 Adv.Server as BLOBS. When I tried to retrieve those files using UTL_ .. package , as is in literature recommended , I obtained in every case non identical , or damaged greater files than originals.
    Help me , please with this my problem.
    Thousand thanks. Jarda.
    When You are so kind to help me , send please Yor response to [email protected]

  • Displaying the BLOB files(PDF,TXT,IMAGE,etc) in the Form as an Attachment

    Hi all,
    I need to Open a file which is stored in the Data base Table & the Data type is of BLOB so i am populating the data but i need to display the attachment which is stored in the BLOB file when the button is clicked & i am using Oracle 10g
    I have been just placed a Button & written the below code in WHEN_BUTTON_PRESSED Trigger & i have tried it out by placing a image icon & WHEN_IMAGE_PRESSED but it's not getting worked
    It is Directly Coming in to Exception..
    DECLARE
    vblob BLOB;
    vmime VARCHAR2(30);
    BEGIN
    select attachment,MIME_TYPE into vblob,vmime
    from Table_name_a
    where UNIQUE_ID = 16842;--:ITEM_RESULT.DRAWINGNO;
    htp.init;
    owa_util.mime_header( vmime, false);
    -- owa_util.mime_header( 'image/jpeg', false);
    -- owa_util.mime_header( 'image/jfif', false);
    -- owa_util.mime_header( 'image/gif', false);
    -- owa_util.mime_header( 'application/word' , FALSE);-- to read MS WORD doc
    owa_util.mime_header( 'application/pdf' , FALSE);-- to read ADObE
    message ('attachment type is' ||vmime);
    message ('attachment type is' ||vmime);
    owa_util.http_header_close;
    wpg_docload.download_file(vblob);
    exception
    when no_data_found then
    dbms_output.put_line('1. attachment type is' ||vmime);
    -- NULL;
    end;
    so if any body has any idea Please let me Know
    Hope for the Reply.
    Thanks & Regards
    K Nikethan Reddy

    Hi,
    Thanks for the reply,
    The Document which u Refer is Showing how to Retrieve the Files from the Local System (i.e by giving the path) but i need to populate it from the database.
    K Nikethan Reddy.

  • Retrieve text file from ftp server every 15 mins

    Hi guys,
    We are able to connect to an FTP server with 5 text files. Every 15 minutes, we need to retrieve each of the 5 files. Please assist me with the coding logic to retrieve the file into the SAP Directory. Any suggestions would be greatly appreciated.
    Regards,
    Sid

    Sid
    Try searching on SCN, there are plenty of materials you can find without even asking a question in the forum.
    How to use SCN search
    For example, if you search with keywords "FTP ABAP", immediately the first two Wiki entries would give you the details you are looking for.
    Rgds
    Eng Swee

  • How do I retrieve a file from Trash using Time Machine in Mavericks?

    Is it even possible to retrieve a file from Trash from a Time Machine backup? Does Time Machine even back up the Trash? I've been told a total restore from a Time Machine backup will put the past Trash back on the Mac, but what if I just want to restore an individual file?
    Shortly after emptying my Trash on my Mac (10.9.4) for the first time in weeks, I realized I needed one of the files I'd just erased. Trying to retrieve with Time Machine was not fruitful, however, because I couldn't find the file on any of the past backups using the normal Enter Time Machine interface. However, I know it would have been in the Trash during all of the most recent backups.
    So I researched how to find the backups of Trash with Time Machine, but I think all of the solutions I found on various online forums were pre-Mavericks and do not seem to work now. I've basically tried 2 things:
    Show Trash in Finder using the Terminal command: open ~/.Trash
    It shows the hidden Trash folder in Finder, located in Macintosh HD/Users/User. For easy access, I added the .Trash folder to the Finder Sidebar. But I can't get to it in the backups. The Trash shortcut in the Finder Sidebar is always grayed out in the old backups using the Time Machine app. And it does not show up in ~ when looking through the backups.backupdb folder on my external HD.
    I also tried the Terminal command to show all hidden files in Finder: defaults write com.apple.finder AppleShowAllFiles YES
    But while many hidden files do suddenly appear in Finder, curiously, the User's .Trash folder is not one. This is true for the Finder of the Mac, the backups.backupdb folder on the External HD, and Time Machine app.
    Thanks.

    How do I retrieve a file from my backup in Time Capsule?
    It depends on the type of file that you are trying to retreive.
    In general.....
    Open Time Machine by clicking on the clock icon on the dock
    Wait a few minutes for Time Machine to fully load
    Use the timeline at the far right of the window to go back in time to a date when the file was still on your Mac
    Click that date
    Navigate using the Finder interface to locate the file that you want
    Click on the file to highlight it
    Click Restore at the lower right of the window to be brought back to the present
    You have to retrieve other types of files differently. For details, see:
    http://pondini.org/TM/28.html

  • How do i insert multiple blob files in Stored procedure using c#?

    i want to add multiple blob files to a stored procedure at one go.Thus i have a 2 dimensional byte array consisting of multiple blob files.How to i add this 2 dimensional array to stored procedure?

    Hi Jeff,
    I haven't tried to insert multiple images at a time, but have done it for single image at a time and composed article on it : BizTalk
    Server 2010: How to Insert Image In SQL Through Orchestration and sample can be found at : 
    BizTalk Server 2010: How to Insert
    Image In SQL Through Orchestration sample.
    I hope it helps.
    Maheshkumar S Tiwari|User
    Page | http://tech-findings.blogspot.com/

  • Please help me, I mistakenly deleted a file.  How can I retrieve my file?

    PLease help me retrieve my file.  I was rearranging some docs into sub-files and mistakenly deleted the main file, thinking the sub-files would still be there and they are all gone.  Lots and lots of docs.  PLEASE HELP ME,!!!  The File name was "Cardis, Jackets, Ponchos& Tops Patterns.  I was using the new Adobe Acrobat Reader.

    I don't believe you can if the only copy is on your iPad.
    You must make backups of files which you have on your mobile devices. Then restore from the backup. Backups could easily made by uploading them to Document Cloud, or backing up to another device.

  • FTP and Internet Explorer lets me retrieve all files in a folder with one click, how to in Firefox?

    I want to use FTP to copy multiple files from a remote machine so I can burn a backup here. I cannot find any syntax in Firefox yet in Internet Explorer 8 I can get a Windows-like display of all remote directories then use Windows commands to 'select all' and/or 'copy to folder' which does the bulk transfer with no further commands. The initial WinXP response to the FTP command is like Firefox in that I have to retrieve each file with a separate command.

    hello, firefox has just a simple viewing capability for files on a ftp server. for more advanced functions please use an extension like fireftp: https://addons.mozilla.org/firefox/addon/fireftp/

  • "Error retrieving xml file from database"

    Hello All,
    I have installed and configured planning with Shared services. While I try to create an instance in Configuration Utility by entering the Instance Name, Host Name, Port (8300) and Click "Next", I get this error -
    *"System failure:Error retrieving xml file from database".*
    My RDBMS is - SQL Server 2005
    OS - Windows 2003 Server
    I am unable to work on planning for few months due to this error.. I would sincerely appreciate if someone can provide me a solution for this..
    Thanks much,
    Varma.

    Hi,
    Ive seen this before.
    If this is a new environment could you create a blank database and configure it as your System database? Then try again and you should be fine.
    I think you may have some invalid entries in your sys database.
    Seb
    www.taysols.com.au

  • Product Instance Registration Error Message: "System Failure: Error while retrieving xml file from database"

    Hi Planning installation Gurus,
    Did u get any luck to resolve this problem as i am also facing same problem "Error creating instance" during install of Planning 9.3.1. i tried 30-50 times reconfiguration every time same problem..
    OS: Vista Premium
    SQL Server 2005
    Essbase:9.3.1
    Error Message: "System Failure: Error while retrieving xml file from database"
    Details of error:::::::::::::::::::::::::
    at com.hyperion.planning.event.HspSysExtChangeHandler.run(Unknown Source
    Can not get JDBC connection for SYS external changed actions.
    Can not get JDBC connection.
    java.lang.NullPointerException
    at com.hyperion.planning.sql.HspSQLImpl.getConnection(Unknown Source)
    at com.hyperion.planning.event.HspSysExtChangeHandler.actionPoller(Unkno
    wn Source)
    at com.hyperion.planning.event.HspSysExtChangeHandler.run(Unknown Source
    Can not get JDBC connection for SYS external changed actions.
    Can not get JDBC connection.
    java.lang.NullPointerException
    at com.hyperion.planning.sql.HspSQLImpl.getConnection(Unknown Source)
    at com.hyperion.planning.event.HspSysExtChangeHandler.actionPoller(Unkno
    wn Source)
    at com.hyperion.planning.event.HspSysExtChangeHandler.run(Unknown Source
    Can not get JDBC connection for SYS external changed actions.
    Can not get JDBC connection.
    Pls provide Solution

    Hi John,
    though i am trying with SQl server authentication with different user but still status is same of planningSystemDB.properties
    SYSTEM_DB_DRIVER=hyperion.jdbc.sqlserver.SQLServerDriver
    SYSTEM_DB_URL=jdbc:hyperion:sqlserver://neeraj-PC:1433
    SYSTEM_DB_USER=windowsAuthentication
    SYSTEM_DB_PASSWORD=CAFBAEFNBGEAABHEDOADFKADACBGBIFHBLCDFBAFFH
    SYSTEM_DB_CATALOG=plandb
    SYSTEM_DB_TYPE=SQL
    INSTANCE=
    my steps:
    Using SQL Server Management Studio
    Changed Widows authentication to SQL server authentication mode
    In SQL Server Management Studio Object Explorer, right-click the server, and then click Properties.
    On the Security page, under Server authentication, select the new server authentication mode, and then click OK.
    In the SQL Server Management Studio dialog box, click OK to acknowledge the requirement to restart SQL Server.
    In SQL Server Management Studio Object Explorer, right-click the server, and then click Properties.
    On the Security page, under Server authentication, select the new server authentication mode, and then click OK.
    In the SQL Server Management Studio dialog box, click OK to acknowledge the requirement to restart SQL Server.
    To restart SQL Server from SQL Server Management Studio
    To enable the sa login by using Management Studio
    In Object Explorer, expand Security, expand Logins, right-click sa, and then click Properties.
    On the General page, you might have to create and confirm a password for the sa login.
    On the Status page, in the Login section, click Enabled, and then click OK.
    In Object Explorer, expand Security, expand Logins, right-click sa, and then click Properties.
    On the General page, you might have to create and confirm a password for the sa login.
    On the Status page, in the Login section, click Enabled, and then click OK.}}}
    anything else should i change.................

  • Product Instance Registration Error: "System Failure: Error while retrieving xml file from database"

    Hi S9 installation Gurus,
    Please try to resolve this long awaited issue with Planning installation as this is purely configuration related issue.
    Detail of Problem:-
    After Susessful configuration of
    1) Foundation Services (Hyperion Shared Services)
    2) Essbase administration services
    3) Essbase Server
    4) Hyperion reporting and analysis
    5) Planning -----> Product options, Register with shared services, configure database, deploy to application server (Appache)
    Error Point: when i tick ckeck box in front of Product instance registration
    click next
    create instance
    click next
    instance name-Plan1
    Web tier host name: my machine name (neeraj-pc, as i installed locally all component of hyperion)
    server port: 8300 (system suggesting)
    tick on active instance
    click next
    Error Pop Up "System Failure: Error while retrieving xml file from database"
    Details of PlanningSystemDB (file :- \Hyperion\common\config\PlanningSystemDB.properties)
    SYSTEM_DB_DRIVER=hyperion.jdbc.sqlserver.SQLServerDriver
    SYSTEM_DB_URL=jdbc:hyperion:sqlserver://neeraj-PC:1433
    SYSTEM_DB_USER=puser
    SYSTEM_DB_PASSWORD=GGAKFJ
    SYSTEM_DB_CATALOG=p1db
    SYSTEM_DB_TYPE=SQL
    INSTANCE=
    Note: puser (SQL Authenticated user)
    Thanks
    Kumar
    Edited by: user10385300 on Dec 4, 2008 5:44 AM

    This has been resolved at :- Product Instance Registration Error Message: "System Failure: Error while retrieving xml file from database"
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • Kernel panic/invalid node structure; please help retrieving my files!!

    Hi everyone, thank you for your time in advance... if anyone has ideas about how to solve it, I appreciate this very much!
    OK, here is how it began: while I was working on the airplane using PowerPoint, the gray spinning wheel appeared after which PowerPoint stopped working. I pressed the power button to exit (all applications froze). (So much for trying to get more work done...)
    Next, I powered up the computer but it would not boot up, with only gray spinning wheel showing.
    Next, tried to boot up while pressing power button and holding shift key. After some time (10 minutes), an error message appears. Researching it on discussion forums, I found that it is called “kernel panic”. Here is beginning of the message:
    panic(cpu 1 caller 0x47f5ad): "Process 1 exec of /sbin/launchd failed, errno 8\n"@SourceCache/xnu/xnu-1504.15.3/bsd/kern/kern_exec.c:3145
    Debugger called: <panic>
    [additional information here]
    Also, message “You need to restart your computer. Hold down the Power button until it turns off, then press the Power button again” is shown transparently in the middle of the screen over the “panic” message output.
    I turned on and off the Power button many times, but I get the same error message.
    I also tried Apple Hardware Test but it did not work (it did not generate any messages).
    Next, I tried to use the Disk Utility using the Installation Disk that came with the computer. After I clicked “Disk Repair”, here is the log:
    Verify and Repair volume “Macintosh HD”
    Checking Journaled HFS Plus volume.
    Checking extents overflow file.
    Checking catalog file.
    Invalid node structure
    Rebuilding catalog B-tree.
    Invalid node structure
    [many repeats of “Invalid node structure”  ~ about 400 repeats]
    Rechecking volume.
    Checking Journaled JFS Plus volume.
    Checking extents overflow file.
    Checking catalog file.
    Missing thread record (id=18)
    Missing thread record (id=110)
    [many instances of “Missing thread record” ~about 200 repeats]
    Checking multi-linked files.
    Checking catalog hierarchy.
    Checking extended attributes file.
    The volume Macintosh HD could not be verified completely.
    Error: Disk Utility can’t repair this disk…disk, and restore your back-up files.
    At the end, a window presented over the error log stated :
    “Disk Utility stopped repairing “Macintosh HD”
    Disk Utility can’t repair this disk. Back up as many of your files as possible, reformat the disk, and restore your back-up files.
    I need to retrieve my recent files!! Please Help!! Argh!! I promise that I will promptly back up my files now! I did not use Time Machine, and only some of my files are backed up.
    From what I read on the discussion forum, I will probably need to erase the disk and then do a fresh installation, but could someone please guide me with regard to how to back up the data / retrieve the files? I may have access to another mac so I’m thinking that the FireWire Target Disk Mode may work. I also have spare external harddrive (formatted for mac) (not partitioned). Also, how do I retrieve the files from the other computer if the FireWire transfer works?
    Also, the second step is to do a new installation, but is there any reason why “Archive and Install” using Disk Utility won’t help? I have some additional programs installed (Illustrator, Photoshop) so this means if I do a new installation, I will need to re-install those as well?
    I did some investigation, and it looks like this problem is similar to this:
    https://discussions.apple.com/message/18098343#18098343
    But my main issue now is to retrieve the files!
    Also, how do I investigate whether this problem is due to a failing hard drive or a natural file system corruption ? (so should I get a new harddrive or do a new install).
    http://forums.macnn.com/t/459376/heart-attack-invalid-node-structure
    I don’t know what is the OS version;  it is Snow Leopard OS X ……. I bought it in September 2009.
    I appreciate any help, thank you so much for your time…

    Create a data recovery/undelete external boot drive
    Step by Step to fix your Mac
    Most commonly used backup methods

  • HT1386 The laptop I originally synch'd my iphone 4s with is broken and cannot retrieve any files. How can I sync the phone with a new laptop without losing all my downloaded music and apps already installed on my iphone?

    The laptop I originally synch'd my iphone 4s with is broken and cannot retrieve any files. How can I sync the phone with a new laptop without losing all my downloaded music and apps already installed on my iphone?

    If the answer to the above question is "yes", FIRST, set up a backup of your new computer before you do anything else so the next time your computer breaks you will not be in the same situation. Backup solutions are numerous and inexpensive, and there is absolutely no excuse in the Third Millennium not to have one.
    Then see this tip: https://discussions.apple.com/docs/DOC-3141

  • I backed up files onto an external hard rive form my old PC. Now I want to retrieve the files to put on my mac but it is telling me to format it to Mac. How can I do this without erasing all of the data on my hard drive?

    I backed up files onto an external hard rive form my old PC. Now I want to retrieve the files to put on my mac but it is telling me to format it to Mac. How can I do this without erasing all of the data on my hard drive?

    Your drive was used with a PC and formatted NTFS which is proprietary Microsoft format.
    You need to install a third party program that will read the NTFS format.
    There is various software from PARAGON, Tuxera and NTFS-3G
    When you get the data off and have verified it to be good, reformat the drive either HFS+ for Mac use only, or for Mac and PC use then MSDOS (FAT32) for under 4GB files (best) or exFAT (for larger than 4GB files) is proprietary and Microsoft is appling for a patent, which would likely mean OS X won't be allowed to read it anymore without a licensing fee and you'l have to pay another third party software company to read the format, just like NTFS is.
    The less you have to rely upon third party sources to read your drives the better, this way if you have a issue and need to read the drive on another machine you don't need the software, and a internet connection and a credit card and...and...and...

Maybe you are looking for

  • Print button on online payslip

    Hi All, How to get print button on online payslip (Self Service)? Regards Jhansi

  • App store cannot connect, error 0x80072efd

    Win 8.1 Pro 64 Bit To clear some other issues, I un-joined the domain on this system and re-joined the domain and linked my MS account with the domain account. All networking is fine expecpt app store. I get cannot connect, 0x80072efd. Metro Weather,

  • Sending notification from MDB to MBean

    Hi Is there a way I can send a notification to an MBean from an MDB? I have a MessageDrivenBean that is listening to a queue. Any message on the queue need to be fwded to the MBean. MBean and the MDB, both are in a jboss sar. The version used is 4.2.

  • Can I use the HTML created in Adobe Edge Reflow?

    Can I use the HTML and CSS code generated to create the webpage preview in Adobe Edge Reflow?

  • Privacy- Diagnostics&Usage- Data

    Hi, Any one knows what the "Data" in Privacy->Diagnostics & Usage->Diagnostics & Usage Data->Data means? And, what are the ".ips" files? Can I "delete" the Data files? Thanks in advance. Ed