CLOB to FILE (or BLOB to file)

How to save into a server-side file a CLOB data ?
Edo.

Possibly read in the text file with FileReader line by line, into one string, then insert with an update too database. Like this....
DataInputStream dis = null;
FileInputStream fis = new FileInputStream("whatEver.xml");
BufferedInputStream bis = new BufferedInputStream(fis);
dis = new DataInputStream(bis);
String myXMl = "":
while ( (line=dis.readLine()) != null )
myXML += line;
//then add you database query to update into the field that is a blob;
But watch out for XMl with dodgey chars like squars, they can effect the performance.
Insuch a case you would read in char by char and ignor these chracters.
good luck hope that helped.
Graham          

Similar Messages

  • 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

  • Parsing BLOB (CSV file with special characters) into table

    Hello everyone,
    In my application, user uploads a CSV file (it is stored as BLOB), which is later read and parsed into table. The parsing engine is shown bellow...
    The problem is, that it won't read national characters as Ö, Ü etc., they simply dissapear.
    Is there any CSV parser that supports national characters? Or, said in other words - is it possible to read BLOB by characters (where characters can be Ö, Ü etc.)?
    Regards,
    Adam
      |
      | helper function for csv parsing
      |
      +-----------------------------------------------*/
      FUNCTION hex_to_decimal(p_hex_str in varchar2) return number
      --this function is based on one by Connor McDonald
        --http://www.jlcomp.demon.co.uk/faq/base_convert.html
       is
        v_dec number;
        v_hex varchar2(16) := '0123456789ABCDEF';
      begin
        v_dec := 0;
        for indx in 1 .. length(p_hex_str) loop
          v_dec := v_dec * 16 + instr(v_hex, upper(substr(p_hex_str, indx, 1))) - 1;
        end loop;
        return v_dec;
      end hex_to_decimal;
      |
      | csv parsing
      |
      +-----------------------------------------------*/
      FUNCTION parse_csv_to_imp_table(in_import_id in number) RETURN boolean IS
        PRAGMA autonomous_transaction;
        v_blob_data   BLOB;
        n_blob_len    NUMBER;
        v_entity_name VARCHAR2(100);
        n_skip_rows   INTEGER;
        n_columns     INTEGER;
        n_col         INTEGER := 0;
        n_position    NUMBER;
        v_raw_chunk   RAW(10000);
        v_char        CHAR(1);
        c_chunk_len   number := 1;
        v_line        VARCHAR2(32767) := NULL;
        n_rows        number := 0;
        n_temp        number;
      BEGIN
        -- shortened
        n_blob_len := dbms_lob.getlength(v_blob_data);
        n_position := 1;
        -- Read and convert binary to char
        WHILE (n_position <= n_blob_len) LOOP
          v_raw_chunk := dbms_lob.substr(v_blob_data, c_chunk_len, n_position);
          v_char      := chr(hex_to_decimal(rawtohex(v_raw_chunk)));
          n_temp      := ascii(v_char);
          n_position  := n_position + c_chunk_len;
          -- When a whole line is retrieved
          IF v_char = CHR(10) THEN
            n_rows := n_rows + 1;
            if n_rows > n_skip_rows then
              -- Shortened
              -- Perform some action with the line (store into table etc.)
            end if;
            -- Clear out
            v_line := NULL;
            n_col := 0;
          ELSIF v_char != chr(10) and v_char != chr(13) THEN
            v_line := v_line || v_char;
            if v_char = ';' then
              n_col := n_col+1;
            end if;
          END IF;
        END LOOP;
        COMMIT;
        return true;
      EXCEPTION
         -- some exception handling
      END;

    Uploading CSV files into LOB columns and then reading them in PL/SQL: [It&#146;s|http://forums.oracle.com/forums/thread.jspa?messageID=3454184&#3454184] Re: Reading a Blob (CSV file) and displaying the contents Re: Associative Array and Blob Number of rows in a clob doncha know.
    Anyway, it woudl help if you gave us some basic information: database version and NLS settings would seem particularly relevant here.
    Cheers, APC
    blog: http://radiofreetooting.blogspot.com

  • File to BLOB

    Hi everybody.
    I'm newbie with Java. How to put file to BLOB field?

    I have read section "Populating a BLOB or CLOB Column in a New Table" from Oracle9i JDBC Developer's Guide and Reference. But i did'n found any answer how to put external file to BLOB field into the table.
    What is wrong in my code?
    public static void file2blob(String fileName, String tableName, String fieldName,
    oracle.sql.ROWID rowid, int compress) throws FileNotFoundException,
    IOException, SQLException
    String sql_in = "SELECT " + fieldName + " FROM " + tableName + " WHERE ROWID = ? FOR UPDATE";
    String sql_out = "UPDATE " + tableName + " SET " + fieldName + " = ? WHERE ROWID = ?";
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@server:1521:test", "system", "manager");
    OraclePreparedStatement stm_in = (OraclePreparedStatement)conn.prepareStatement(sql_in);
    OraclePreparedStatement stm_out = (OraclePreparedStatement)conn.prepareStatement(sql_out);
    stm_in.setROWID(1, rowid);
    OracleResultSet rs_in = (OracleResultSet)stm_in.executeQuery();
    // I getting here ORA-01002 fetch out of sequence!
    if (rs_in.next())
    BLOB blob = rs_in.getBLOB(1);
    OutputStream blobStream = blob.getBinaryOutputStream();
    FileInputStream fileStream = new FileInputStream(fileName);
    byte[] buffer = new byte[1024];
    int numRead;
    while ((numRead = fileStream.read(buffer)) != -1)
    blobStream.write(buffer, 0, numRead);
    fileStream.close();
    stm_out.setBLOB(1, blob);
    stm_out.setROWID(2, rowid);
    stm_out.execute();
    stm_out.close();
    rs_in.close();
    stm_in.close();

  • Getting issue while downloading 4 to 5 gb file from blob storage.

    Hi i have to download a file from blob storage upto 3 to 5 gb .
    Below is my code:
    Label lblfilename = (Label)row.FindControl("lblGrid_filename");
        Label lblfilesize = (Label)row.FindControl("lblGrid_hidfileSize");
        string downloadfile = lblfilename.Text.ToString();
       // DownloadFileFromBlob(downloadfile, CONTAINER, ACCOUNTKEY);
        AccountFileTransfer = CloudStorageAccount.Parse("DefaultEndpointsProtocol=https;AccountName=" + ACCOUNTNAME + ";AccountKey=" + ACCOUNTKEY);
        if (AccountFileTransfer != null)
            BlobClientFileTransfer = AccountFileTransfer.CreateCloudBlobClient();
            ContainerFileTransfer = BlobClientFileTransfer.GetContainerReference(CONTAINER);
            ContainerFileTransfer.CreateIfNotExist();
            BlobRequestOptions options = new BlobRequestOptions();
            options.Timeout = new TimeSpan(0, 180, 0);
        var data = Regex.Match(lblfilesize.Text.ToString(), @"\d+").Value;
        int value32;
        Int64 value64;
        var blobSize = 0L;
        var blockSize = 0L;
        var offset = 0L;
        if (int.TryParse(data, out value32))
            blobSize = Convert.ToInt32(lblfilesize.Text.ToString());
        else if (Int64.TryParse(data, out value64))
            blobSize = Convert.ToInt64(lblfilesize.Text.ToString());
        var blob = ContainerFileTransfer.GetBlockBlobReference(downloadfile);
        var sasUrl = blob.Uri.AbsoluteUri;
        CloudBlockBlob blockBlob = new CloudBlockBlob(sasUrl);
        //blobSize = Convert.ToInt32(lblfilesize.Text.ToString());
        blockSize = 5 * 1024 * 1024;
        Response.Clear();
        Response.ContentType = "APPLICATION/OCTET-STREAM";
        System.String disHeader = "Attachment; Filename=\"" + blockBlob.Name + "\"";
        //Response.AppendHeader("Content-Disposition", disHeader);
        for (offset = 0; offset < blobSize; offset += blockSize)
            using (var blobStream = blockBlob.OpenRead())
                if ((offset + blockSize) > blobSize)
                    blockSize = (blobSize - offset);
                byte[] buffer = new byte[blockSize];
                blobStream.Read(buffer, 0, buffer.Length);
                Response.BinaryWrite(buffer);
                Response.Flush();
        Response.End();
    SNAPSHOT of error:
    Pawan

    Hi Will thanks per the reply
    I have make some changes in the code and now i am using the v4.0.30319 azure storage for downloading and able to download a file upto 3.5 GB. Now the problem is that each file size is showing 0 KB.
    Here is my code and snapshot:
      Button btndownloadrow = (Button)sender;
        GridViewRow row = (GridViewRow)btndownloadrow.NamingContainer;
        Label lblfilename = (Label)row.FindControl("lblGrid_filename");
        Label lblfilesize = (Label)row.FindControl("lblGrid_hidfileSize");
        string downloadfile = lblfilename.Text.ToString();
        CloudStorageAccount AccountFileTransfer = CloudStorageAccount.Parse("DefaultEndpointsProtocol=http;AccountName=" + ACCOUNTNAME + ";AccountKey=" + ACCOUNTKEY);
        // Create the blob client.
        CloudBlobClient BlobClientFileTransfer = AccountFileTransfer.CreateCloudBlobClient();
        // Retrieve reference to a previously created container.
        CloudBlobContainer ContainerFileTransfer = BlobClientFileTransfer.GetContainerReference("filetransfer");
        if (AccountFileTransfer != null)
            BlobClientFileTransfer = AccountFileTransfer.CreateCloudBlobClient();
            CloudBlockBlob pageBlob = ContainerFileTransfer.GetBlockBlobReference(CONTAINER);
            ContainerFileTransfer.CreateIfNotExists();
            BlobRequestOptions options = new BlobRequestOptions();
            options.ServerTimeout= new TimeSpan(0, 180, 0);
        var data = Regex.Match(lblfilesize.Text.ToString(), @"\d+").Value;
        int value32;
        Int64 value64;
        var blobSize = 0L;
        var blockSize = 0L;
        var offset = 0L;
        if (int.TryParse(data, out value32))
            blobSize = Convert.ToInt32(lblfilesize.Text.ToString());
        else if (Int64.TryParse(data, out value64))
            blobSize = Convert.ToInt64(lblfilesize.Text.ToString());
        CloudBlockBlob blob = ContainerFileTransfer.GetBlockBlobReference(downloadfile);
        var sasUrl = blob.Uri;
        CloudBlockBlob blockBlob = new CloudBlockBlob(sasUrl);
        //blobSize = Convert.ToInt32(lblfilesize.Text.ToString());
        blockSize = 4 * 1024 * 1024;
        Response.Clear();
        Response.ContentType = "APPLICATION/OCTET-STREAM";
        System.String disHeader = "Attachment; Filename=\"" + blockBlob.Name + "\"";
        Response.AppendHeader("Content-Disposition", disHeader);
       // blob.DownloadToStream(Response.OutputStream);
       // byte[] bytes = new byte[blockSize];
        for (offset = 0; offset < blobSize; offset += blockSize)
            using (var blobStream = blockBlob.OpenRead())
                if ((offset + blockSize) > blobSize)
                    blockSize = (blobSize - offset);
            byte[] buffer = new byte[blockSize];
                blobStream.Read(buffer, 0, buffer.Length);
                Response.BinaryWrite(buffer);
                Response.Flush();
        Response.End();
    SNAPSOT:
    Please suggest me if i am missing any logic.
    Pawan

  • How to upload a image or flash file as blob object in a table.

    How to upload a image or flash file as blob object in a table.
    What are all the possible ways we can do it.

    Searching the forum (or google) would be my first choice, as this question pops up every now and then.
    Next without knowledge of your environment (jdev version and technology stack) it's hard to give a profound answer.
    All I can say is that it's possible.
    Timo

  • How can i put a file into blob(using sun.jdbc.odbc.JdbcOdbcDriver)

    Hi
    i tried to put a file into blob , but got a problem.....
    My environment:windows 2000pro,JBuilder 5.0 enterprise,oracle 8.1.6,(not install oracle jdbc driver )
    a part of program(my program is very uglily,if anyone want,later i paste it ba....~_~)
    //Statement stmt2=null;
    //Resultset rs2;
    //opa1 is the blob data
    void saveBlobTableToDisk(Connection con) {
    try {
    stmt2=con.createStatement();
    sqlStr2="SELECT * FROM emp3 where id=1004";
    rs2=stmt2.executeQuery(sqlStr2);
    while (rs2.next()) {
    Blob aBlob=rs2.getBlob("opa1");
    i got the exception :
    " null
    java.lang.UnsupportedOperationException
         at sun.jdbc.odbc.JdbcOdbcResultSet.getBlob(JdbcOdbcResultSet.java:4174)
         at test3.Frame1.saveBlobTableToDisk(Frame1.java:48)
         at test3.Frame1.<init>(Frame1.java:26)
         at test3.Application1.<init>(Application1.java:5)
         at test3.Application1.main(Application1.java:8) "
    and the windows pop up a messagebox said that(about) my memory "0x09af007f" could not read, error in javaw.exe .
    Later i used (ResultSet)getBinaryStream() to solve it. but getBinaryStream() only return a InputStream,so that i can make blob to a file,but i can't make a file to blob using jdbc.....
    I am very stupid that installing sun java, oracle jdbc driver etc....(because i must set a lot of thing such as classpath,java_home etc), Can i only use JBuilder to do that ?
    Or i must install oracle jdbc driver ?
    Thanks.

    My guess here is that Sun's JDBC-ODBC bridge doesn't handle the BLOB datatype. Most ODBC drivers don't support that datatype, so I wouldn't expect the bridge to.
    Is there a reason that you can't use the Oracle driver?
    Justin

  • How can i put a file into blob using jdbc !?

    Hi
    i tried to put a file into blob , but got a problem.....
    My environment:windows 2000pro,JBuilder 5.0 enterprise,oracle 8.1.6,(not install oracle jdbc driver )
    a part of program(my program is very uglily,if anyone want,later i paste it ba....~_~)
    //Statement stmt2=null;
    //Resultset rs2;
    //opa1 is the blob data
    void saveBlobTableToDisk(Connection con) {
    try {
    stmt2=con.createStatement();
    sqlStr2="SELECT * FROM emp3 where id=1004";
    rs2=stmt2.executeQuery(sqlStr2);
    while (rs2.next()) {
    Blob aBlob=rs2.getBlob("opa1");
    i got the exception :
    " null
    java.lang.UnsupportedOperationException
         at sun.jdbc.odbc.JdbcOdbcResultSet.getBlob(JdbcOdbcResultSet.java:4174)
         at test3.Frame1.saveBlobTableToDisk(Frame1.java:48)
         at test3.Frame1.<init>(Frame1.java:26)
         at test3.Application1.<init>(Application1.java:5)
         at test3.Application1.main(Application1.java:8) "
    and the windows pop up a messagebox said that(about) my memory "0x09af007f" could not read, error in javaw.exe .
    Later i used (ResultSet)getBinaryStream() to solve it. but getBinaryStream() only return a InputStream,so that i can make blob to a file,but i can't make a file to blob using jdbc.....
    I am very stupid that installing sun java, oracle jdbc driver etc....(because i must set a lot of thing such as classpath,java_home etc), Can i only use JBuilder to do that ?
    Or i must install oracle jdbc driver ?
    Thanks.
    D.T.

    My guess here is that Sun's JDBC-ODBC bridge doesn't handle the BLOB datatype. Most ODBC drivers don't support that datatype, so I wouldn't expect the bridge to.
    Is there a reason that you can't use the Oracle driver?
    Justin

  • WEBUTIL upload file to blob and save a file in database harddisk

    Dear all,
    Webutil have a file upload from client to blob.
    It can run smoothlly.
    My problem is, how to download my file on the blob into a file in database harddisk.
    For your information, my file is DBF data file.
    Pls help me.
    Best regards
    Jansen Hutagalung

    Why do you try with BFILE type?

  • After uploading file in BLOB using webutil file on system locked?

    I uploaded file in BLOB using webutil upload utility. But after uploading it locks the file and i cannot delete the file unless i close the iexplorer window.
    Is there any way to unlock the file and delete it with out closing the application(iexplorer). If any body knows please reply.
    Regards,
    Muhammad Qazzafi

    can you post the statements, which you use for the upload ?
    thx
    Gerd

  • Stored PDF files with Blob

    I have being storing PDF files using Blob, but it is getting very time consuming to access these files again.
    Is there a better way of doing it? Is there a right way of doing it? I do not need to search inside the PDF, but I do need to access them either inside the Database or outside.
    Thank You for nay help

    I have a need to store PDF files that are documents that will complement process that my systems creates. And I need that those PDF files be accessible from inside my system, I do not need to search insede them because they will be stored by subject inside another subject, therefore whoever need the files will know were to find it, but to store and to access it is taking longer and longer as more files are added to the first thead.

  • Save Uploaded file in BLOB column of Database

    Hey,
    Anyone knows how to save uploaded file in BLOB column of database.
    Please need help asap.
    i get following error:
    Cannot convert org.apache.myfaces.trinidadinternal.config.upload.UploadedFiles$FixFilename@1c1fc8d of type class org.apache.myfaces.trinidadinternal.config.upload.UploadedFiles$FixFilename to class oracle.jbo.domain.BlobDomain.
    Can anyone tell me what needs to be done.
    Thanks,
    Sneha

    Hi Timo,
    We are using oracle Jdeveloper Studio Edition Version 11.1.1.6.0 . logs are just showing nullpointer exception. Following errors are shown in logs:
    <ActionListenerImpl> <processAction> java.lang.NullPointerException
    javax.faces.el.EvaluationException: java.lang.NullPointerException
      at org.apache.myfaces.trinidad.component.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:51)
      at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
      at org.apache.myfaces.trinidad.component.UIXCommand.broadcast(UIXCommand.java:190)
      at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$1.run(ContextSwitchingComponent.java:92)
      at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:361)
      at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:96)
      at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:102)
      at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$1.run(ContextSwitchingComponent.java:92)
      at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:361)
      at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:96)
      at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:96)
      at oracle.adf.view.rich.component.fragment.UIXRegion.broadcast(UIXRegion.java:148)
      at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.broadcastEvents(LifecycleImpl.java:1018)
      at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:386)
      at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:194)
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
      at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
      at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
      at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
      at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
      at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:205)
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
      at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:106)
      at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446)
      at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
      at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446)
      at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:271)
      at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:177)
      at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
      at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119)
      at java.security.AccessController.doPrivileged(Native Method)
      at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:315)
      at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:442)
      at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103)
      at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171)
      at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
      at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:139)
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
      at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
      at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
      at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
      at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
      at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
      at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
      at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
      at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
      at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
      at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
    Caused by: java.lang.NullPointerException
      at view.bean3.ImageBean.uploadFileValueChangeEvent(ImageBean.java:80)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at com.sun.el.parser.AstValue.invoke(Unknown Source)
      at com.sun.el.MethodExpressionImpl.invoke(Unknown Source)
      at org.apache.myfaces.trinidad.component.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:46)
      ... 51 more
    <LifecycleImpl> <_handleException> ADF_FACES-60098:Faces lifecycle receives unhandled exceptions in phase INVOKE_APPLICATION 5
    javax.faces.FacesException: #{samplebean2.uploadFileValueChangeEvent}: java.lang.NullPointerException
    And one more error i get and i.e.
    XmlErrorHandler> <handleError> ADF_FACES-60096:Server Exception during PPR, #1
    javax.servlet.ServletException: java.lang.NullPointerException
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:277)
      at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
      at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
      at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
      at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
      at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:205)
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
      at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:106)
      at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446)
      at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
      at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446)
      at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:271)
      at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:177)
      at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
      at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119)
      at java.security.AccessController.doPrivileged(Native Method)
      at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:315)
      at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:442)
      at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103)
      at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171)
      at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
      at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:139)
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
      at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
      at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
      at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
      at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
      at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
      at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
      at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
      at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
      at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
      at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
    Caused by: javax.faces.el.EvaluationException: java.lang.NullPointerException
      at org.apache.myfaces.trinidad.component.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:51)
      at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
      at org.apache.myfaces.trinidad.component.UIXCommand.broadcast(UIXCommand.java:190)
      at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$1.run(ContextSwitchingComponent.java:92)
      at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:361)
      at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:96)
      at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:102)
      at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$1.run(ContextSwitchingComponent.java:92)
      at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:361)
      at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:96)
      at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:96)
      at oracle.adf.view.rich.component.fragment.UIXRegion.broadcast(UIXRegion.java:148)
      at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.broadcastEvents(LifecycleImpl.java:1018)
      at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:386)
      at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:194)
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
      ... 36 more
    Caused by: java.lang.NullPointerException
      at view.bean3.ImageBean.uploadFileValueChangeEvent(ImageBean.java:80)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at com.sun.el.parser.AstValue.invoke(Unknown Source)
      at com.sun.el.MethodExpressionImpl.invoke(Unknown Source)
      at org.apache.myfaces.trinidad.component.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:46)
      ... 51 more
    <Utils> <buildFacesMessage> ADF: Adding the following JSF error message: Attempt to access dead view row of persistent id 17
    oracle.jbo.DeadViewRowAccessException: JBO-27102: Attempt to access dead view row of persistent id 17
    Can you help me on this one. Any other details you need let me know.

  • Getting a PDF file in BLOB variable

    Hi Forum,
    I want to get a PDF file in BLOB variable from DB server.
    Further I will pass that variable to a procedure; in that procedure that variable will be inserted into a table.
    I have called procedure (inserting BLOB into a table) is ready.
    Can someone advice?
    thanks,
    regards.

    user573927 wrote:
    Hi Forum,
    I want to get a PDF file in BLOB variable from DB server.
    Further I will pass that variable to a procedure; in that procedure that variable will be inserted into a table.
    I have called procedure (inserting BLOB into a table) is ready.
    Can someone advice?It's all fine you saying what you want, but how about telling us what you've already done and where it's going wrong

  • Someone used upload files into blob in JDeveloper 10.1.3.2 ?

    Someone used upload files into blob in JDeveloper 10.1.3.2 ?
    I used Steve Muech example 85, but after downloading , downloaded files doesn't work ?
    I prepared test case http://www.sttb.pl/jakub/UploadAndDownloadBlob.zip - meybe someone resolve it.
    Regards
    Kuba

    Hi,
    There is no problem with download in above example. I have used Steve's example to upload, and solution delivered by Ric Smith on his blog to download files. I think there is something wrong with Steve's uploading solution. When I used Ric solution (he sent me by email complete JDeveloper project) to upload and download everyting works correct. I created last Friday SR on Metalink to review it and it's still in progress. My advice is:
    1) Look onto Ric Smith blog:
    http://thepeninsulasedge.com/blog/2006/08/17/reading-and-writing-blobdomains-to-and-from-an-adf-uploadfile/
    and
    http://thepeninsulasedge.com/blog/2006/11/06/adf-faces-and-adf-bc-fileupload-and-blobs-continued/
    2) Ask him to send JDeveloper project or update email to your profile - I'll send you directly this project that I retrieved from Ric Smith
    Regards
    Kuba

  • Load blob to file. error: file write error

    Hi,
    I used procedure witch load blob to file. It's working at Oracle 10g, but its does't work on oracle 11g. Why?
    create or replace PROCEDURE load_blob_to_bfile (p_file_id IN VARCHAR2, p_directory IN VARCHAR2, p_ident in varchar2 default NULL)
    IS
    v_blob BLOB;
    v_start NUMBER := 1;
    v_bytelen NUMBER := 2000;
    v_len NUMBER;
    v_raw RAW (2000);
    v_x NUMBER;
    v_output UTL_FILE.file_type;
    v_file_name VARCHAR2 (200);
    BEGIN
    -- get length of blob
    SELECT DBMS_LOB.getlength (blob_content), filename
    INTO v_len, v_file_name
    FROM wwv_flow_files
    WHERE filename = p_file_id;
    -- define output directory
    v_output := UTL_FILE.fopen (p_directory, p_ident||'_'||v_file_name, 'wb', 32760);
    -- save blob length
    v_x := v_len;
    -- select blob into variable
    SELECT blob_content
    INTO v_blob
    FROM wwv_flow_files
    WHERE filename = p_file_id;
    v_start := 1;
    WHILE v_start < v_len AND v_bytelen > 0
    LOOP
    DBMS_LOB.READ (v_blob, v_bytelen, v_start, v_raw);
    UTL_FILE.put_raw (v_output, v_raw);
    UTL_FILE.fflush (v_output);
    /* Text only could be: UTL_RAW.cast_to_varchar2 (v_raw);*/
    -- set the start position for the next cut
    v_start := v_start + v_bytelen;
    -- set the end position if less than 32000 bytes
    v_x := v_x - v_bytelen;
    IF v_x < 2000
    THEN
    v_bytelen := v_x;
    END IF;
    END LOOP;
    UTL_FILE.fclose (v_output);
    END;
    directories is creaited and granted for read and write. It looks like file is created, but application rise the write file error, and files in directory is emty.
    TomasB

    So, I'm copying the file in a temp. BLOB with this function:
    FUNCTION get_remote_binary_data (p_conn IN OUT NOCOPY UTL_TCP.connection,
    p_file IN VARCHAR2)
    RETURN BLOB IS
    l_conn UTL_TCP.connection;
    l_amount PLS_INTEGER;
    l_buffer RAW(32767);
    l_data BLOB;
    BEGIN
    DBMS_LOB.createtemporary (lob_loc => l_data,
    CACHE => TRUE,
    dur => DBMS_LOB.CALL);
    l_conn := get_passive(p_conn); //get a passive connection
    send_command(p_conn, 'RETR ' || p_file, TRUE); //send Retrieve command to server
    BEGIN
    LOOP
    l_amount := UTL_TCP.read_raw (l_conn, l_buffer, 32767);
    DBMS_LOB.writeappend(l_data, l_amount, l_buffer);
    END LOOP;
    EXCEPTION
    WHEN UTL_TCP.END_OF_INPUT THEN
    NULL;
    WHEN OTHERS THEN
    NULL;
    END;
    UTL_TCP.close_connection(l_conn);
    get_reply(p_conn);
    RETURN l_data;
    END;
    Then I'm writing it into a local file:
    PROCEDURE put_local_binary_data (p_data IN BLOB,
    p_dir IN VARCHAR2,
    p_file IN VARCHAR2) IS
    l_out_file UTL_FILE.FILE_TYPE;
    l_buffer RAW(32767);
    l_amount BINARY_INTEGER;
    l_pos INTEGER := 1;
    l_blob_len INTEGER;
    BEGIN
    l_blob_len := DBMS_LOB.getlength(p_data);
    l_amount := DBMS_LOB.GETCHUNKSIZE(p_data);
    IF (l_amount >= 32767) THEN
    l_amount := 32767;
    END IF;
    l_out_file := UTL_FILE.FOPEN(p_dir, p_file, 'w', 32767);
    WHILE l_pos < l_blob_len LOOP
    DBMS_LOB.READ (p_data, l_amount, l_pos, l_buffer);
    UTL_FILE.put_raw(l_out_file, l_buffer, FALSE);     
    l_pos := l_pos + l_amount;
    END LOOP;
    UTL_FILE.FCLOSE(l_out_file);
    EXCEPTION
    WHEN OTHERS THEN
    IF UTL_FILE.IS_OPEN(l_out_file) THEN
    UTL_FILE.FCLOSE(l_out_file);
    END IF;
    RAISE;
    END;
    I've checked the blob before I'we wrote it ito the file (UTL_FILE.put_raw(l_out_file, l_buffer, FALSE)), and it contains no carriage-return.

Maybe you are looking for

  • PO line item table EKPO-TECHS?

    Dear Gurus, Kindly inform me what is this EKPO-TECHS (Parameter Variant/Standard Variant) field? The F1 doucmentaion does not explain the business process how it is used. Also, where can we find this field in PO line item detail (ME21n)? We have Zero

  • Acrobat 9.3 Pro shows "An internal error occurred" while exporting to JPG

    I used Acrobat 9.3 Pro to export PDF to JPG, and it shown "An internal error occurred." How do some PDF files occur this error ? How to resolve this problem ? Thanks.

  • Mouse stutter and UI unresponsiveness after returning from standby

    Hi guys, after upgrading to Leopard the mouse pointer on my 15" MBP stutters after returning from standby. Weird thing is that this happens only after it was in standby for awhile, maybe 5 to 10 minutes. If I return from standby after a few seconds t

  • Problem to import music to itunes

    i have a problem i download music from limewire and im not able to transfer it to my itune program to put it in my ipod shuffle, i wanna know if its possible and if it is how can i do it thanks

  • How many parameters can function at the same time?

    Post Author: leongcy23 CA Forum: General Dear all, I have a situation where I need to use about 6 parameters in a report. In the Record Selection Formula Editor of the main report, I put "OR" for every parameters, which mean I can select either one o