File saving in DB. Please, help!!!!!!!!

Hello,
I need your help very very much.
My data base is Oracle 9i.
I'd like to save file as Blob in the table of the data base.
What I have to do?

To write to blob
import oracle.sql.*;
import oracle.jdbc.driver.*;
//variables
oracle.sql.BLOB blob = null;
try {
     StringBuffer sbf = new StringBuffer();
     try {
          // fileObject is the file you wish to read
          FileInputStream fin = new FileInputStream(fileObject);
          long fileLen = fileObject.length();
          int counter = 0 ;
          while ( counter < fileLen ) {
               char c = (char) fin.read();
               sbf.append(c);
               counter++;
     } catch ( Exception e ) {
          throw e ;
     byte[] bArray = sbf.toString().getBytes();
     //get databse connection
     Class.forName(DRIVER_NAME);
     connection = DriverManager.getConnection(DATABASE_INFO,username,password);
     //execute query
     query = "select BLOB_FIELD from TABLE_NAME FOR UPDATE";
     statement = connection.createStatement();
     resultset = statement.executeQuery(query);
     while (resultset.next()) {
          blob = ((OracleResultSet)resultset).getBLOB("BLOB_FIELD");
     OutputStream outputStream = blob.getBinaryOutputStream();
     int bytes_a_time = 2048;
     int bytesWritten = 0;
     int start = 0;
     int length = bArray.length;
     if (bytes_a_time > length) {
          bytes_a_time=length;
     while (bytesWritten < length) {
          outputStream.write(bArray,start,bytes_a_time);
          start = (start + bytes_a_time);
          bytesWritten = bytesWritten + bytes_a_time;
          if ((bytesWritten+bytes_a_time) > length) {
               bytes_a_time=length-bytesWritten;
}catch(Exception e){
To read blob value
//variables
bArray     = null;
oracle.sql.BLOB blob = null;
try {
     //get databse connection
     Class.forName(DRIVER_NAME);
     connection = DriverManager.getConnection(DATABASE_INFO,username,password);
     //execute query
     query = "select BLOB_FIELD from TABLE_NAME";
     statement = connection.createStatement();
     resultset = statement.executeQuery(query);
     while (resultset.next()) {
          blob                = ((OracleResultSet)resultset).getBLOB("BLOB_FIELD");
          int length          = (int)blob.length();
          byte[] bArray     = new byte[length];
          bArray                = blob.getBytes(1,length);
}catch(Exception e){

Similar Messages

  • I really need someone to help me. I have been trying to figure out how to select a PDF document to convert to a Word doc. When I go to select a PDF file, all that shows up is the WORD docs. does not show ANY of my PDF files... Please help me figure out wh

    I really need someone to help me. I have been trying to figure out how to select a PDF document to convert to a Word doc. When I go to select a PDF file, all that shows up is the WORD docs. does not show ANY of my PDF files... Please help me figure out what is going on? We have it set on auto renewal so I know its not that we haven't renewed this subscription, because we pay automatically.

    Hi olivias,
    It sounds like there may be some confusion on your system about what application should be associated with PDF files. You can reset filename associations by following the steps in these articles (depending on your operating system):
    How to change the default application for a file type | Macworld
    http://windows.microsoft.com/en-us/windows/change-default-programs#1TC=windows-7
    Please let us know if you have additional questions.
    Best,
    Sara

  • Created PDF form in Acrobat XI Pro, but HELP fields disappear when I save FCDT file to PDF. Please help. Thanks!

    Created PDF form in Acrobat XI Pro, but HELP fields disappear when I save FCDT file to PDF. Please help. Thanks!

    I am not aware of a field type "Help" within a PDF form. I do not see it as a form field that can be added in the form edit mode.
    Forms Central forms do not support all the features of Acrobat forms.
    Are you talking about the "Tool Tips" or a hidden field that only shows when one enters a field and is hidden upon exiting the field.

  • HT1553 Hi, I'm stuck at step 9. I don't see my external harddrive when I want to save the DMG backup file. Can you please help me with this? I'm desperate to make this backup! Big thanx in advance!

    Hi, I'm stuck at step 9. I don't see my external harddrive when I want to save the DMG backup file. Can you please help me with this? I'm desperate to make this backup! Big thanx in advance!
    http://support.apple.com/kb/HT1553

    Repair permissions and restart your computer.  If this does not work, zap the pram.  You should now see your external hard drive. 

  • Hello i am rajesh i am having problem while conveting other files into pdf format please help me

    i am rajesh i am having problem while converting other files into acrobat format please help me

    Hello Rajesh,
    I'm sorry to hear you're having trouble. Are you using Acrobat.com to convert your files to PDF? Please let me know where you are having trouble and I will do my best to help you convert your files. For your reference, here is a list of filetypes that can be converted to PDF online with Acrobat.com:
    http://kb2.adobe.com/cps/524/cpsid_52456.html#Create%20PDF
    Best,
    Rebecca

  • I am trying to stream music from my iMac using iTunes music files to my Cocktail Audio X10 music streamer. I have allowed my files to be shared the X10 sees the files but when I try to accsess them it gives me the message files not mounted. Please help?

    I am trying to stream music from my iMac using iTunes music files to my Cocktail Audio X10 music streamer. I have allowed my files to be shared the X10 sees the files but when I try to accsess them it gives me the message files not mounted. Please help?

    No, I have the music I want to move from the laptop to the phone selected. Then I go under file, devices, and try to click sync but it is not available to click.

  • I receive the below error when imprting an .eex file .... please help

    I receive the below error when imprting an .eex file .... please help
    C:\Documents and Settings\skarnam\Desktop\WFS Fixed Assets BA.eex:Access is denied trying to modify the Business Area with identifier 'WFS_Fixed_Assets'
    C:\Documents and Settings\skarnam\Desktop\WFS Fixed Assets BA.eex:Access is denied trying to modify the Business Area with identifier 'WFS_Fixed_Assets'
    C:\Documents and Settings\skarnam\Desktop\WFS Fixed Assets BA.eex:Access is denied trying to modify the Business Area with identifier 'WFS_Fixed_Assets'
    C:\Documents and Settings\skarnam\Desktop\WFS Fixed Assets BA.eex:Access is denied trying to modify the Business Area with identifier 'WFS_Fixed_Assets'
    C:\Documents and Settings\skarnam\Desktop\WFS Fixed Assets BA.eex:Access is denied trying to modify the Business Area with identifier 'WFS_Fixed_Assets'
    C:\Documents and Settings\skarnam\Desktop\WFS Fixed Assets BA.eex:Access is denied trying to modify the Folder with identifier 'XXWFS_FA_ASSETS_V'
    C:\Documents and Settings\skarnam\Desktop\WFS Fixed Assets BA.eex:Access is denied trying to modify the Item with identifier 'ASSET_NUMBER'
    C:\Documents and Settings\skarnam\Desktop\WFS Fixed Assets BA.eex:Access is denied trying to modify the Item with identifier 'DATE_PLACED_IN_SERVICE'
    C:\Documents and Settings\skarnam\Desktop\WFS Fixed Assets BA.eex:Access is denied trying to modify the Item with identifier 'DEPRECIATION_AMT'
    C:\Documents and Settings\skarnam\Desktop\WFS Fixed Assets BA.eex:Access is denied trying to modify the Item with identifier 'DEPRECIATION_METHOD'
    C:\Documents and Settings\skarnam\Desktop\WFS Fixed Assets BA.eex:Access is denied trying to modify the Item with identifier 'DESCRIPTION'
    C:\Documents and Settings\skarnam\Desktop\WFS Fixed Assets BA.eex:Access is denied trying to modify the Item with identifier 'LIFE_IN_MONTHS'
    C:\Documents and Settings\skarnam\Desktop\WFS Fixed Assets BA.eex:Access is denied trying to modify the Item with identifier 'ORIGINAL_COST'
    C:\Documents and Settings\skarnam\Desktop\WFS Fixed Assets BA.eex:Access is denied trying to modify the Item with identifier 'PERIOD_NAME'
    C:\Documents and Settings\skarnam\Desktop\WFS Fixed Assets BA.eex:Access is denied trying to modify the Item with identifier 'YTD_DEPERIATION_AMT'
    Import completed, but with warnings. Please check the result.
    File(s) imported partially :
    C:\Documents and Settings\skarnam\Desktop\WFS Fixed Assets BA.eex

    Hi,
    You don't say what components you are trying to import into the EUL. But it could be that you are importing a business area which has security access granted to a user that is not defined on the target system. It could also be that the user you are using to do the import does not have admin access to all the components you are importing.
    Rod West

  • I was listening to a you tube clip.  i guess i didn't click off the actual clip, because now when i turn on my computer the clip audio plays. i can't locate the file to delete it. please help.

    i was listening to a you tube clip.  i guess i didn't click off the actual clip, because now when i turn on my computer the clip audio plays. i can't locate the file to delete it. please help.

      Quit Safari.
      Hold the shift key down and relaunch Safari.
    Empty Caches
    Safari > Preference > Advanced
    Checkmark the box for "Show Develop menu in menu bar".
    Develop menu will appear in the Safari menu bar.
    Click Develop and select "Empty Caches" from the dropdown.
    Best.

  • Replacing places.sqlite with older file is not working, please help I need my bookmarks

    My hard drive was recently crashed so I had to reinstall windows 7 operating system. I recovered the deleted places.sqlite file from before the crash. I replaced the old file with new places.sqlite file but is not restoring any of the bookmarks
    Please help, I have a lot of important bookmarks stored in old file
    Please suggest a way to open the places.sqlite file manually & extract bookmarks from it or any other way to get the bookmarks back

    It is possible that this copy of places.sqlite is corrupted if your bookmarks aren't restored and in that case you can't use this file and will have to delete all the places files (-shm and -wal as well)
    If you also have a copy of the JSON backups in the bookmarkbackups folder then try to restore the bookmarks that way.
    *http://kb.mozillazine.org/Backing_up_and_restoring_bookmarks_-_Firefox
    *https://support.mozilla.org/kb/restore-bookmarks-from-backup-or-move-them
    You can check for problems with the <b>places.sqlite</b> database file in the Firefox profile folder.
    *http://kb.mozillazine.org/Bookmarks_history_and_toolbar_buttons_not_working_-_Firefox
    *https://support.mozilla.org/kb/Bookmarks+not+saved#w_fix-the-bookmarks-file
    See also:
    *Places Maintenance: https://addons.mozilla.org/firefox/addon/places-maintenance/

  • Putting 2 vob files onto 1 DVD -Please help

    I borrowed a handicam that burns to mini DVD, as mine broke. Usually I import files as DV on the mac from my camera and cut them together there.
    With this camera, I have two halves of a recital that I want to put onto 1 DVD. I saved the DOB files from each mini disc ont my Mac and I figured I would just put them both into iDVD or edit with iMovie and burn onto 1 DVD, but I cannot import or use DOB files with them. I also have Final Cut Express, but again - no DOB files. iMovie won't take them.
    I tried converting the files with VLC or MPEG Stream on a PC but the audio and video don't sync.
    All I want to do is put both VOB files on a DVD that will play in a DVD player.
    Please help me! I am extremely frustrated and under a deadline...

    Make your sequences, export out as DV AVI files, bring them into Encore and author as usual.

  • ORA-03113: end-of-file on communication channel, Please help

    hello Seniors,
    i have strange situation, facing it for the first time.
    i m/s detail form and i am entering data. i successfully saved few records.
    i completed entering one more record and for a reason i left it unsaved.
    after lets say may be a minute or so, i got back to work and then tried to save the unsaved record
    displayed on screen. when i pressed save button i got error;
    ORA-03113: end-of-file on communication channel
    leaving the form as is with this error displayed, i notice that i can very well use the db at server level
    by running other sqls, meaning other resources are functioning. even i tried to open the same application again
    leaving the erroneous form as is, and tried to enter in another form , it communicated well and saved without any errors.
    also there is one more errro along with this, when i query; says "Unable to perform query"
    ORA-01041: internal error. hostdef extension doesn't exist
    and when exit the current form it quits the entire application and kills that particular session,
    but the db is still up and running with no errors.
    The Tnsping <hostname> is responding.
    i want to know while entring on a form, is there any time-out limit between the entry and saving point?
    or any other solution please help. vm thankful.
    my db
    SQL*Plus: Release 10.2.0.1.0 - Production on Sat Jul 25 09:31:46 2009
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    Connected to:
    Oracle Database 10g Release 10.2.0.1.0 - Production
    form;
    Forms [32 Bit] Version 6.0.8.25.2 (Production)
    Oracle Database 10g Release 10.2.0.1.0 - Production
    Oracle Toolkit Version 6.0.8.25.0 (Production)
    PL/SQL Version 8.0.6.3.0 (Production)
    Oracle Procedure Builder V6.0.8.21.0 Build #1459 - Production
    PL/SQL Editor (c) WinMain Software (www.winmain.com), v1.0 (Production)
    Oracle Query Builder 6.0.7.1.0 - Production
    Oracle Virtual Graphics System Version 6.0.5.38.0 (Production)
    Oracle Tools GUI Utilities Version 6.0.8.25.0 (Production)
    Oracle Multimedia Version 6.0.8.25.0 (Production)
    Oracle Tools Integration Version 6.0.8.18.0 (Production)
    Oracle Tools Common Area Version 6.0.8.18.0
    Oracle CORE Version 4.0.6.0.0 - Production
    Edited by: user10967485 on Jul 25, 2009 12:47 AM
    Edited by: user10967485 on Jul 25, 2009 12:52 AM

    i was testing entering into different forms of my application.
    what i notice that this problem persist with just one form i.e. my purchase order header-details form.
    whats happening is, it allows just the first or rather 1 record (incase if are in a query mode and select create record),
    saving the next or IInd record returns this error. God knows why..?
    can you please suggest any debugging technique to catch the theif?
    i have WNFI, POSt-FORM-COMMIT, KEY-COMMIT, PRE-COMMIT, PRE-FORM at form level
    at heade block i have ;
    PRE-INSERT,UPDATE,DELETE, PRE-RECORD,POST-QUERY, KEY-ENTQRY, ON-POPULTE-DET
    at detail blcok i have;
    PRE-INSERT,UPDATE,PRE-RECORD,POST-QUERY,WHEN-REMOVE-RECORD.
    sqlnet.ora, i have at 4 different dir;
    C:\orant\NET80\ADMIN & C:\orant\NET80\ADMIN\SAMPLE AND
    C:\oracle\product\10.2.0\db_1\NETWORK\ADMIN & C:\oracle\product\10.2.0\db_1\NETWORK\ADMIN\SAMPLE
    I am not so good with Dba interface, so please suggest me which particular file should refer and
    where & what exactly should i look for..? as the file contains a comrehensive entries.
    thankyou once again.
    on displaying error from Help i get this;
    INSERT INTO PURCHASE_ORDER_DETAIL) VALUES ) RETURNING ROWID,POD_COMP_CODE,POD_DATE,POD_POH_CODE,POD_POH_NO,POD_REMARKS,POD_CR_UID,POD_CR_DT,POD_UPD_UID,POD_UPD_DT,POD_PROD_CODE,POD_UOM,POD_QTY,POD_RATE,POD_CURR_CODE,POD_FX_RATE,POD_fc_AMOUNT,POD_LC_AMOUNT INTO :1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13,:14,:15,:16,:17,:18
    ORA-03113: end of on communication channel.

  • Can find backup files!!! Please help

    Lost my BB last week in DFW airport. Just got a replacement today and was excited to get back and restore my data. I thought it would be on the desktop but I can not find it anywhere. I have searched for .ipd files and nothing shows. I specifically remember backing up not long ago but do not know the exact date. PLEASE HELP ME. Like everyone else on this board, I live (and will die) with this thing. I have a ka-jillion work and customer contacts.
    Thanks for all that help. I will try anything.

    Oh man I feel for you.
    Your backup will be saved as a *.ipd file. Search the entire PC.
    Often the saved file will default to the My Documents folder. Look there as well.
    Good luck.
    1. If any post helps you please click the below the post(s) that helped you.
    2. Please resolve your thread by marking the post "Solution?" which solved it for you!
    3. Install free BlackBerry Protect today for backups of contacts and data.
    4. Guide to Unlocking your BlackBerry & Unlock Codes
    Join our BBM Channels (Beta)
    BlackBerry Support Forums Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • Photoshop CC program error when opening or placing files. VERY FRUSTRATING PLEASE HELP.

    I'm an advertising graduate student that relies heavily on Adobe programs for my multiple simultaneous projects throughout the school year, specifically Photoshop, Illustrator, InDesign, Muse, Edge Animate and Premiere Pro.
    I'm using a MacBook Pro running OS X Yosemite.
    I have been experiencing an incredibly frustrating issue with Photoshop and Muse, both CC 2014. I'll speak about Photoshop in this thread since, well, this is a Photoshop forum. This has been happening for almost a year now. I figured Adobe would've fixed this problem by now, especially given the myriad of crash reports I send.
    While working in Photoshop, sometimes when I go to place a file I get an error message that says "Could not complete your request because of a program error." It used to be that this error was fatal and I would have no other choice but to force quit out of Photoshop and restart it. We all know how incredibly time-consuming it is for Photoshop to open (especially 10-15 times in one sitting), and being in grad school, time is not something I have a lot of when I have deadlines and projects due.
    This error is still happening and for the same reasons; however, now I can still continue to work on my file, as long as I don't need to open a document or place an image...which doesn't help very much because I'm doing a lot of mockups and composites and need those functionalities. It happens probably 90% of the time when I try to place or open a document.
    For the record, it's a similar issue that's causing Muse to crash as well. When I try to add an image file, it causes the entire program to crash "unexpectedly," as Muse so eloquently puts it.
    Until recently I had kept CS6 on my hard drive and would dig it out to use in place of CC when PSCC would crash; however, someone told me that having both versions was likely the cause for the crashes. After much hesitation, I finally uninstalled all of CS6 from my hard drive the other day (the right way, not into the trash can, since someone is inevitably going to ask that question) and I'm still having this problem, and now I don't have my CS6 version to fall back on and now I'm in a really bad spot.
    I apologize for all the rambling, but I'm really very, very frustrated with this error, and I had to do something while waiting for Photoshop to restart. Someone please help.

    MacOS 10.10? Yeah, Apple is working on that bug.  They already fixed the crash in the open/save dialogs, but have a few more problems to address with the open/save dialogs.

  • My kids put in the password wrong into my iphone 4s now it gives me a message saying iphone disabled. how do I get it u locked again hopefully with my  photos saved on it. please help. thanks.

    How do I unlock an iphone that has a message stating iphone disabled. Is it possible to have my photos still saved on it. Please help. Thanks.

    As for your photos, hopefully you can restore from a backup ...
    Follow the instructions here >  iOS: Forgotten passcode or device disabled after entering wrong passcode

  • Can't convert Canon CR2 RAW files to photoshop CS2- please help!

    I have a Canon EOS Rebel XT and am using Photoshop CS2 and can not open my Raw images. Canon saves the images as a CS2 file. I guess needs converting.. Please Help!!

    Daag Kees,
    >[Kees] DNG converter 4_3_1 don't convert my raw Leica M8- images to digital negatives files that will open in Photoshop CS 8.0.1. (Camera raw 2.0).
    Of course not. You need ACR (Camera Raw) version 2.4. Version 2.0 does NOT support DNGs.
    After you correctly install ACR 2.4 according to the instructions on the download page and after you relaunch Photoshop, you need to Purge the Cache for each folder.
    >[Michael] Simply run the DNG converter and point it at your M8 raw files and they will be converted to DNG.
    Nope. Point the DNG Converter to a folder containing RAW files, not to the raw files themselves. The DNG Converter works on Folders containing raw files, not on individual files.
    >What means "using Bridge" ?
    Forget that. It does NOT apply to Photoshop 8.x. In CS3, you can have ACR hosted either by Photoshop or by Bridge. Photoshop 8.x doesn't even have Bridge.
    Prettige Kerstdagen!

  • Error installing Adobe in Program Files... PLEASE HELP!

    Hi,
    I´m trying to install the trial of Adobe CS6 Master Collection (FOR PC) in the folder Program files and I always get this message:
    "download may fail to this folder due to restrictive access privileges. Please select a different folder."
    I´ve tried installing it in another folders and the problem is the same... If I try to install it in a completely different place (as the desktop), it initially lets me but after that, when the installation starts, it says that there is the error 109 and that I cannot install...
    WHAT CAN I DO? PLEASE HELP!
    Thank you very much.

    We cannot know, but it sounds like you simply don't have the proper user privileges and are not the administrator. This is nothing Adobe can fix for you. Talk to your IT department/ the computer owner or if in fact you are your own admin, log in with a proper account and turn off security tools and whatnot...
    Mylenium

Maybe you are looking for

  • Error while opening a workitem in UWL

    Dear All, There is a leave application in webdynpro abap and workflow, in which when the initiator apply for the leave the request is generated and the work item is send to the UWL but when the approver clicks on the workitem id in his UWL it is not

  • Advice on how i can set up an office network with 40 computers.

    I am planning on setting up an office network with 40 computers. What do you think is the best way i can do this? Thank you in advance.

  • What does this error message mean?   Bridges Parent application is not active

    I updated my Bridge and now I can't use it because I get this message Bridges Parent application is not active Bridge requires that a qualifying product has been launched at least once to enable this feature

  • IDOC -to -BAPI -to -BAPI scenario

    Hi ,    my scenario is   IDOC - to - BAPI - and BAPI(Response) -to - BAPI (Req) . I think a bit confusion  . Actually I'm getting the data from  MDM system through an IDOC  into XI system  and I want to post this data into an ECC system by using RFC.

  • Region.addObserver Problem with PHP Files

    Hi, I try to load a Dynamic XML via PHP Files. everything works fine. but when i use a Region.addObserver the callback function dont trigger. It only happen with php Files. My code is quote: <script language="JavaScript" type="text/javascript" src="{