Storing a file in a BLOB field in the database through forms

Hi, I want to have a form that lets the user choose a file he has on his client side and load this file into a BLOB field in the database.
I know how to use "GET_FILE_NAME" to get the file, the second part is what I'm having problems with. Do I use an OLE object? How do I initailize it? Or what is the best way to go? Thanks.
--Bassem                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Are you looking for something like this?
DECLARE
   l_temp  clob;
   l_text  varchar2(2000);
BEGIN
    l_temp := httpuritype('http://www.oracle.com/PO.xsd').getclob;
    l_text := substr(l_temp, 1, 2000);
    dbms_output.put_line(l_text);
END;N.B.: Not Tested...
Regards.
Satyaki De.

Similar Messages

  • How to Save pdf file in the BLOB field in the database

    I have to save a pdf file which is on the client machine to save in the database column of type BLOB. How can i do that?

    LostWorld wrote:
    I have to save a pdf file which is on the client machine to save in the database column of type BLOB. How can i do that?PL/SQL code cannot hack across the network. break into that client machine, and read that PDF file from the client's harddrive.
    There is a very fundamental client-server principle at stake here - the purpose of the client. What is the purpose of the client? Amongst others, it is to interface with the client hardware and peripherals and devices. Like reading the client keyboard and sending that to the server. Or reading data from the sever and rendering it on the client's display device. Or to receive CSV data from the server and writing it to a local file.
    It's purpose is also to read a local file, like a PDF file, and submit that file's contents to the server for storage.
    The following pseudo code explains the basic principle:
    client
      // call oracle to create a LOB
      ExecuteSQL( 'DBMS_LOB.CreateTemporary( .. )' )
      open file( fileHandle )
      while not EOF( fileHandle )
        // read data from the file
        read file( fileHandle, buffer )
        // write this buffer to the LOB in Oracle
        ExecuteSQL( 'DBMS_LOB.writeAppend( .. )' )
      end while
      close file( fileHandle )
      // now tell Oracle what to do with that LOB
      ExecuteSQL( '...' )
      .. etc..Thus the client:
    a) creates a LOB in Oracle via a PL/SQL call
    b) passes data from the client and appends it to the LOB
    c) tells Oracle what to do with LOB, such as inserting it into a table

  • How to store file content in BLOB field MySql database using java

    Hi!
    i want to store the file content in a BLOB field in MySql database using java.
    Please help me out..........
    thanx in advance...
    bye

    i stored images in db, and retrieved them. like that cant i store pdf file in db, and retrieve it back using oracle db?
    Plz help me out how to put a file in db. i need complete code. thanks in advance.

  • How to upload a file to a BLOB column in the DB using PL/SQL???

    Hi
    I am trying to upload a file to a BLOB column in my database. I wana do this using some pl/sql procedure.I don't wana use webutil. is it possible??? and if so can anybody help me with this???
    Regards
    Shiraz

    Hello,
    This is a stored procedure sample that show how insert into CLOB, BLOB and BFILE columns
    CREATE OR REPLACE PROCEDURE Insert_document
         PC$Type IN DOCUMENT.TYP%TYPE
        ,PC$Nom IN DOCUMENT.NOM_DOC%TYPE
        ,PC$Texte IN VARCHAR2
        ,PC$Image IN VARCHAR2 
        ,PC$Fichier IN VARCHAR2
       ) IS
      L$Blob BLOB;
      L$Clob CLOB;
      L$Bfile BFILE;
      LN$Len NUMBER := dbms_lob.lobmaxsize;
      LN$Num NUMBER ;
      LN$src_off PLS_INTEGER := 1 ;
      LN$dst_off PLS_INTEGER := 1 ;
      LN$Langctx NUMBER := dbms_lob.default_lang_ctx ;
      LN$Warn NUMBER;
      BEGIN
        -- Création of new raw --
        If PC$Fichier is not null Then
           L$Bfile := BFILENAME( 'FICHIERS_IN', PC$Fichier );
        End if ;
        -- Creation of temporary objetcs --
        dbms_lob.createtemporary( L$Clob, TRUE ) ;
        dbms_lob.createtemporary( L$Blob, TRUE ) ; 
        -- Loading text in CLOB column --
        If PC$Texte is not null Then
           L$Bfile := BFILENAME( 'FICHIERS_IN', PC$Texte );
           dbms_lob.fileopen(L$Bfile, dbms_lob.file_readonly);
           If dbms_lob.fileexists( L$Bfile ) = 1 Then
             dbms_output.put_line(PC$Texte || ' open' ) ;
             dbms_lob.loadclobfromfile(
                                       L$Clob,                -- Destination CLOB
                                       L$Bfile,               -- Source file pointer
                                       LN$Len,                -- # bytes to read
                                       LN$src_off,            -- Source start position
                                       LN$dst_off,            -- Target start position
                                       dbms_lob.default_csid, -- CSID
                                       LN$Langctx,            -- Language Context
                                       LN$Warn);              -- Warning message
             dbms_lob.fileclose(L$Bfile);
          Else
             raise_application_error( -20100, 'Erreur ouverture ' || PC$Texte ) ;
          End if ;
        End if ;
        -- Loading image in BLOB column --
        If PC$Image is not null Then
           L$Bfile := BFILENAME( 'FICHIERS_IN', PC$Image );
           dbms_lob.fileopen(L$Bfile, dbms_lob.file_readonly);
           dbms_lob.loadblobfromfile(
                                     L$Blob,       -- BLOB de destination
                                     L$Bfile,      -- Pointeur de fichier en entrée
                                     LN$Len,       -- Nombre d'octets à lire
                                     LN$src_off,   -- Position source de départ
                                     LN$dst_off);  -- Position destination de départ
           dbms_lob.fileclose(L$Bfile);
        End if ; 
        -- Save --
        Insert into DOCUMENT (ID, NOM_DOC, TYP, UTILISE, LOB_TEXTE, LOB_DATA, LOB_FICHIER)
               Values( SEQ_DOCUMENT.NEXTVAL, PC$Nom, PC$Type, NULL, L$Clob, L$Blob, L$Bfile ) ; 
        -- Free the temporary objects --
        dbms_lob.freetemporary( L$Clob ) ;
        dbms_lob.freetemporary( L$Blob ) ; 
      END;
    /The table structure for this sample is the following:
    CREATE TABLE DOCUMENT (
      ID           NUMBER (5) PRIMARY KEY,
      TYP          VARCHAR2 (20),
      UTILISE      VARCHAR2 (30),
      LOB_TEXTE    CLOB,
      LOB_DATA     BLOB,
      LOB_FICHIER  BFILE,
      NOM_DOC      VARCHAR2 (100))
    /Francois

  • Access BLOB field in Oracle database

    Dear Sir,
    I am using Pro* C to access oracle blob fields
    I write "12345" to Oracle Blob field, when I read it it is fine.
    I then modify this record to "ABC", when I read it, I get "ABC45",
    How can I set blob field to the initial state to modify BLOB field correctly ?
    Many Thanks
    Liang

    Initially you write 12345 and when you modify you are modiyfing only 3 bytes from offset 1 and hence the results. When you modify oracle will not erase the complete lob you need to use erase before you modify (write)
    Following doc give you an insight into pl/sql lob functions
    http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28419/d_lob.htm#sthref4428
    Following is the Pro*C Lobs Guide
    http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28427/pc_16lob.htm#i998068

  • Change the Order of Fields in the Search Lookup Form

    Hi guys,
    The end user has requested me to change the order of the fields in the Search Lookup Form. I haven't found any configuration to change this order, so I changed the JSP (tjspLookupFormTiles.jsp) as below:
    <bean:define id="colIDsObj" name="lookupFieldForm" property="columnIDs"/>
    <%
    //Sort Column IDs
    String[] colIDs = (String[]) pageContext.getAttribute("colIDsObj");
    colIDs[0] = "Lookup Definition.Lookup Code Information.Decode";
    colIDs[1] = "Lookup Definition.Lookup Code Information.Code Key";
    %>
    Is there any property where I can change this order without change the JSP File?
    Thanks,
    Renato.

    I had a similar requirement in the past, but could not find any other way for doing this. It does not reverse the order even for lookup fields on USR forms, for which the encode and decode values are defined in formmetadata.xml. Changing jsp seems to be the only way, unless someone else knows better.

  • Error while inserting BLOB value in the database

    I am trying to insert a BLOB value in the database. This action results in the following exception:
    java.sql.SQLException: ORA-22925: operation would exceed maximum size allowed for a LOB value
    The method i am using is as follows:
    public void insertBlob(Connection Con, StringBuffer Message)throws SQLException
    String Query = "INSERT INTO MSGBLOCKS (MSGDB_ID, MSGBLOCKTYPE, MESSAGE) VALUES (20, 1 , ?)";
    PreparedStatement PS = Con.prepareStatement(Query);
    byte[] bytes = new String(Message).getBytes();
    ByteArrayInputStream bi = new ByteArrayInputStream(bytes);
    PS.setBinaryStream(1, bi, bytes.length);
    PS.executeUpdate();
    The manifest file of ojdbc14.jar being used is: 10.1.0.5.0 and I am using jdk 1.4.
    Also the message being tried to insert is of 9 Kb only.
    Any help would be greatly appreciated.
    Thanks!!!

    Did you check if the Message is having only that small 9kb of data? also check the maximum allowed size for that column in the Oracle DB, the size can be restricted to 8Kb also.
    Edited by: DynamicBasics on Jul 28, 2010 5:54 PM

  • Store and Display doc/pdf files in the database using Forms

    Hi all,
    How can i store and display doc/pdf files in the database using Forms 10g?.
    Arif

    How to get up and running with WebUtil 1.06 included with Oracle Developer Suite 10.1.2.0.2 on a win32 platform
    Solution
    Assuming a fresh "Complete" install of Oracle Developer Suite 10.1.2.0.2,
    here are steps to get a small test form running, using WebUtil 1.06.
    Note: [OraHome] is used as an alias for your real oDS ORACLE_HOME.
    Feel free to copy this note to a text editor, and do a global find/replace on
    [OraHome] with your actual value (no trailing slash). Then it is easy to
    copy/paste actual commands to be executed from the note copy.
    1) Download http://prdownloads.sourceforge.net/jacob-project/jacob_18.zip
      and extract to a temporary staging area. Do not attempt to use 1.7 or 1.9.
    2) Copy or move jacob.jar and jacob.dll
      [JacobStage] is the folder where you extracted Jacob, and will end in ...\jacob_18
         cd [JacobStage]
         copy jacob.jar [OraHome]\forms\java\.
         copy jacob.dll [OraHome]\forms\webutil\.
      The Jacob staging area is no longer needed, and may be deleted.
    3) Sign frmwebutil.jar and jacob.jar
      Open a DOS command prompt.
      Add [OraHome]\jdk\bin to the PATH:
         set PATH=[OraHome]\jdk\bin;%PATH%
      Sign the files, and check the output for success:
         [OraHome]\forms\webutil\sign_webutil [OraHome]\forms\java\frmwebutil.jar
         [OraHome]\forms\webutil\sign_webutil [OraHome]\forms\java\jacob.jar
    4) If you already have a schema in your RDBMS which contains the WebUtil stored code,
      you may skip this step. Otherwise,
      Create a schema to hold the WebUtil stored code, and privileges needed to
      connect and create a stored package. Schema name "WEBUTIL" is recommended
      for no reason other than consistency over the user base.
      Open [OraHome]\forms\create_webutil_db.sql in a text editor, and delete or comment
      out the EXIT statement, to be able to see whether the objects were created witout
      errors.
      Start SQL*Plus as SYSTEM, and issue:
         CREATE USER webutil IDENTIFIED BY [password]
         DEFAULT TABLESPACE users
         TEMPORARY TABLESPACE temp;
         GRANT CONNECT, CREATE PROCEDURE, CREATE PUBLIC SYNONYM TO webutil;
         CONNECT webutil/[password]@[connectstring]
         @[OraHome]\forms\create_webutil_db.sql
         -- Inspect SQL*Plus output for errors, and then
         CREATE PUBLIC SYNONYM webutil_db FOR webutil.webutil_db;
      Reconnect as SYSTEM, and issue:
         grant execute on webutil_db to public;
    5) Modify [OraHome]\forms\server\default.env, and append [OraHome]\jdk\jre\lib\rt.jar
      to the CLASSPATH entry.
    6) Start the OC4J instance
    7) Start Forms Builder and connect to a schema in the RDBMS used in step (4).
      Open webutil.pll, do a "Compile ALL" (shift-Control-K), and generate to PLX (Control-T).
      It is important to generate the PLX, to avoid the FRM-40039 discussed in
      Note 303682.1
      If the PLX is not generated, the Webutil.pll library would have to be attached with
      full path information to all forms wishing to use WebUtil. This is NOT recommended.
    8) Create a new FMB.
      Open webutil.olb, and Subclass (not Copy) the Webutil object to the form.
      There is no need to Subclass the WebutilConfig object.
      Attach the Webutil.pll Library, and remove the path.
      Add an ON-LOGON trigger with the code
             NULL;
      to avoid having to connect to an RDBMS (optional).
      Create a new button on a new canvas, with the code
             show_webutil_information (TRUE);
      in a WHEN-BUTTON-PRESSED trigger.
      Compile the FMB to FMX, after doing a Compile-All (Shift-Control-K).
    9) Under Edit->Preferences->Runtime in Forms Builder, click on "Reset to Default" if
      the "Application Server URL" is empty.
      Then append "?config=webutil" at the end, so you end up with a URL of the form
          http://server:port/forms/frmservlet?config=webutil
    10) Run your form.sarah

  • How to change the default password file's name and path when the database created?

    how to change the default password file's name and path when the database created?
    null

    Usage: orapwd file=<fname> password=<password> entries=<users>
    where
    file - name of password file (mand),
    password - password for SYS and INTERNAL (mand),
    entries - maximum number of distinct DBA and OPERs (opt),
    There are no spaces around the equal-to (=) character.

  • How to display or generate PDF417 barcode dynamically in PDF form? I am using Acrobat XI Professional and there is a Bar Code Field in the same through which I generated the same. But I want to generate the same dynamically.

    How to display or generate PDF417 barcode dynamically in PDF form? I am using Acrobat XI Professional and there is a Bar Code Field in the same through which I generated the same. But I want to generate the same dynamically.

    What do you mean by dynamically? When yo set up a 2D bar code field you specify which field name/value pairs you want to include, along with other parameters. But be aware that they won't work with Reader unless you Reader-enable the document with LiveCycle Reader Extensions and include the bar code usage right. It will work with Acrobat Standard/Pro.

  • How to open a file created at the server through form/report at client end

    How to open a file created at the server through form/report at client end
    Dear Sir/Madame,
    I am creating a exception report at the server-end using utl file utility. I want to display this report at the client end. A user doesn't have any access to server. Will u please write me the solution and oblige me.
    Thanks
    Rajesh Jain

    One way of doing this is to write a PL/SQL procedure that uses UTL_FILE to read the file and DBMS_OUTPUT to display the contents to the users.
    Cheers, APC

  • To replace values of one of the field in the database table

    How to replace values of one of the field in the database table with a new values? Pls help to solve

    Hi
    You can use the UPDATE command to update one of the field value in a table
    see the UPDATE syntax and use it
    but in real time you should not do like this
    Regards
    Anji

  • How to Add Values in INVOICE SUB-TYPE field at the Invoice Header Forms

    Hello,
    Does any body knows how could I add/modify values in the INVOICE SUB-TYPE field at the Invoice Header Forms?. This values are related to the Globalization, in this case for the Chilean Localizations.
    Thanks,
    Alejandro R.

    It gives any error or just does nothing?
    Have you tried making another simple form with just one block and one or two items?
    You can do this type of testing in these conditions.
    Which version of forms are you using?

  • How to get the value for the LIT_Withheld field in the city tax form?

    I am trying to get the value for the LIT_Withheld field on the city tax form , PAYUSEET.. This is not a database column but is generated based on some conditions.. Appreciate the help. Thanks, Suguna

    Hi Abhmanyu,
    Thanks for your response.
    Search Help Name : ZZ_MG_MARITAL_VH
    Selection Method  : T502T
    Search help parameters are SPRSL, FAMST, FTEXT,
    Can u provide me a sample code to fetch the value of corresponding text.
    Thanks,
    Hari

  • How to bind JtextFields in Swing to Table fields in the database

    Can some one give the code of how to bind JtextFields in Swing to Table fields in the database
    Am really new to java programming and have interest in learning

    The standard JDK doesn't do this for you. If you search on Google, you may find some 3rd party packages that will do this.
    You need to create your own form add execute the appropriate SQL yourself. Read the tutorial on [url http://java.sun.com/docs/books/tutorial/]JDBC Database Access to get started.

Maybe you are looking for

  • How to change db_unique_name

    I cant change this parameter... SQL> alter system set db_unique_name='sth' ERROR at line 1: ORA-02095: specified initialization parameter cannot be modified Why? and how to change? /Gökhan Özkanat

  • Problems awaking from sleep

    I have it set that when I put my laptop to sleep it asks for my password when it awakes. I have always done this. The last two times I put it to sleep a blank screen comes up and the spinning beach ball of death just keeps spinning and nothing happen

  • Issue Related to Price & Taxinn

    Dear Gurus, I have a scenario There is a component that is purchase for Basic price of pattern = 19530   Rs (X) For this there is also pattern value                                                  = 93        Rs (Y) Total value                      

  • Get pageContext in a tag file

    How can I get pageContext variable in a tag file? I'm trying something like <%tagBean.init(pageContext);%> and compiler says it cannot resolve pageContext. Thanks for help. Denis Krukovsky http://dotuseful.sourceforge.net/

  • Uninstalling CS2

    With the purchase of CS3, I have no use for the CS2 I already have on the system. How do I uninstall CS2 and change all the file associations from the CS2 programs to the equivalent CS3 programs?