Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Image Upload and store in oracle db

RamyaAMay 28 2015 — edited Jun 6 2015

Hi Experts,

           I am using jdev  11.1.1.5.0.

for that i refer a link as https://www.youtube.com/watch?v=9vHUzHeq95k.

My Bean was

          

private BlobDomain createBlobDomain(UploadedFile file)

{

        System.out.println("enter into a method");

        InputStream  inStream =null;

        OutputStream outStream=null;

        BlobDomain domain=null;

    domain = new BlobDomain();

    try {

        inStream = file.getInputStream();

        System.out.println("enter into a inStream");

        outStream = domain.getBinaryOutputStream();

        byte[] buffer = new byte[8192];

        int byteRead=0;

        while((byteRead = inStream.read(buffer,0,8192))!=-1) {

        outStream.write(buffer,0,byteRead);

        }

        inStream.close();

    }

    catch(SQLException e) {

        e.printStackTrace();

    }

    catch(IOException e) {

        e.printStackTrace();

    }

    return domain;

   

    }

private UploadedFile _File;

  

    public String UploadProcess() {

       UploadedFile file= this.getFile();

       System.out.println("enter into a method");

       BindingContext bindingctx=BindingContext.getCurrent();

       BindingContainer bindingcnt =bindingctx.getCurrentBindingsEntry();

       DCBindingContainer bindingImple =(DCBindingContainer)bindingcnt;

       DCIteratorBinding dciter=bindingImple.findIteratorBinding("CrmMktgLeadsVO1Iterator");

        ViewObject vo  = dciter.getViewObject();

        Row row = vo.getCurrentRow();

      //Row row =iterator.getCurrentRow();

       row.setAttribute("CmlImageId",createBlobDomain(file));

        return null;

    }

    public void setFile(UploadedFile _File) {

        this._File = _File;

    }

    public UploadedFile getFile() {

        return _File;

    }

    public void setIf1(RichInputFile if1) {

        this.if1 = if1;

    }

    public RichInputFile getIf1() {

        return if1;

    }

While Clicking a uploadImageProcess button it shows a Null pointer Exception.

How to Achieve this.

Thanks

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 4 2015
Added on May 28 2015
36 comments
2,304 views