Question about File upload functionality in Weblogic

Hi,
    We're currently trying to deploy a web application on the weblogic 12c server (via war file). And the app needs to upload a text file onto the a temperary directory within weblogic server. And on the web page side, we use JQuery File upload plugin.
    My question is, on the file receiver side, does weblogic provide any tools to receive the uploaded file and store it?
Thanks very much in advance.

Hi,
Before setting the string or xstring to server->response->set_cdata (string) or server->response->set_data (xstring) try this:
CONCATENATE 'attachment;filename=' lv_filename '.xml'  INTO lv_string.
* Setting the filename by default
  server->response->set_header_field( name  = 'Content-Disposition'
                                      value = lv_string ).
Hope this helps.
Regards,
Abhinav

Similar Messages

  • Question about file uploads

    is having a file upload function on a web page a hard thing to do?
    i need to do this, but i do not know where to start...
    if anyone can help me out/shed some light on this for me that would be greatly appreciated!~!!!
    THANKS!

    No it is not particularly difficult; I let the user select a file on the client filesystem then upload to the server.
    The form ENCTYPE must be multipart/form-data:
    <FORM NAME="frmUpload" ENCTYPE="multipart/form-data" METHOD="POST" ACTION=...>
    Use:
    <INPUT TYPE="file" NAME="srcFile" SIZE="15" MAXLENGTH="40">
    In my servlet:
    verify:
    String contentType = request.getHeader("Content-Type");
    if (contentType.indexOf("multipart/form-data") < 0)     {
    ...handle error...
    String boundary = contentType.substring(contentType.indexOf("boundary=") + 9, contentType.length());
    private boolean TransferFile(ServletInputStream is, String srcFile,
    String destDir,String caseNo, String boundary, String errorPage,
    HttpServletRequest request, HttpServletResponse response) throws ServletException
    File pathName = new File(...);
    // If the target directory does not already exist then create it.
    if (!pathName.exists()) {
    pathName.mkdir();
    if (!pathName.exists()) {  // did mkdir work?
    ... do lots more checking ...
    boolean xferOK = false;
    try {
    FileOutputStream fout = new FileOutputStream(...);
    byte[] nextBytes = null;
    byte[] currBytes = null;
    while ((nextBytes = ReadLine(is)) != null) {
    if (currBytes != null) {
    String snippet = "";
    if (nextBytes.length - 10 <= boundary.length())
    snippet = new String(nextBytes);
    if (snippet.indexOf(boundary) < 0)
    fout.write(currBytes, 0, currBytes.length);
    else
    fout.write(currBytes, 0, currBytes.length - 2);
    currBytes = nextBytes;
    fout.close();
    xferOK = true;
    catch (IOException ioe) {
    return xferOK;
    } // TransferFile()
    Hope this helps

  • Some question about the renegotiation function in SRM Contract (GOA)

    Hi All Expert,
    We are on SRM 5/4.6,  there is a question about the renegotiation function in SRM GOA.
    Can we renegotiate the price for some parts in the GOA items with this function ( e.g. Only renegotiate one item in the contract) ?
    Will the item price updated automatically after the renegotiation?
    Many thanks in advance!!!
        Wendrin

    Hi Sanjeev,
    Many thanks for your help.
    One more question, if I add a new item when we renegotiation, will it be transfered to contract and create a new item after that?
    Thanks and best regards
    Wendrin

  • Questions about user-defined functions

    Hello all,
    I've got some questions about user-defined function in a message mapping:
    1) How can I get the current date/time in format yyyy-mm-dd hh:mm:ss ? What is the java code for this?
    2) I want to use the StreamTransformation constant TIME_SENT, only this is not in the right time-zone.
    It is GMT and it should be CET (1 hour difference). How can I convert this in Java?
    Can somebody help me with this?
    Thanks in advance.
    Kind regards,
    Marco van Iersel

    Hi Marco,
    If the date format is fixed as you have mentioned,please use this:
                                    String test = "2009-03-27 23:15:30";
              String test1 = test.substring(11,13);
              if(!test1.equals("23"))
              int a = Integer.parseInt(test1);
              int b = a+1;
              System.out.println("b"+b);
              String c = Integer.toString(b);
                                    test = test.substring(0,10)+" " + c + test.substring(13,19);
                                    return test;
              if(test1.equals("23"))
              test = test.substring(0,10)+ " 00" + test.substring(13,19);
              return test;
                                    else return "";
    Kindly let me know if this works.
    Thanks.
    Regards.
    Shweta

  • File Uploading API in weblogic?

              Hi
              We are working on weblogic 8.1.Is there any File uploading API in weblogic API
              Thanks
              Sougata
              

              Have you consider jakarta commons file upload.
              "sougata" <[email protected]> wrote:
              >
              >Hi
              >We are working on weblogic 8.1.Is there any File uploading API in weblogic
              >API
              >Thanks
              >Sougata
              >
              

  • Question about PL/SQL Function in report

    Hi all. I have a (basic) question about using a PL/SQL function in a report. In my report page I have an item (PL/SQL function) that has the following syntax:
    return username from t1
    where username like 'Le%'
    I reference this item in an email process. Ideally this function would return all usernames that begin with 'Le' in the drafted email; however, its not looping so I'm only getting a return on the first name.
    I have a few books on PL/SQL but I'm not exactly sure where to start - I imagine there is a loop process I need to integrate into the function but, like I said, I'm not sure.
    I would have posted this to the PL/SQL forum but also wanted some feedback on whether or not using this method is the best way forward. Essentially I have a table with usernames and just want to send email messages based on some simple logic.
    Thanks!
    Len

    Hi Sergio,
    First, it's an honor to have you reply to my post. Thanks!
    To be more specific,
    T1 is a table containing the results from a user security scan. Username is a column in this table containing user names. What I have done is create a page in HTML DB with the following elements:
    1. An 'Item' containing the PL/SQL function that is hidden. The purpose of this Item is to generate information from T1 that meets the simple logic parameters - in this case, the user names that begin with "Le". I have called this Item P145_TT
    2. A 'Process' containing references to HTMLDB_MAIL. The 'Process' looks similar to this:
    HTMLDB_MAIL.SEND(
    P_TO => '[email protected]',
    P_FROM => 'Anon Email Account',
    P_BODY => 'Note: This message was automatically generated. Do not attempt to reply to this email.
    These are the users that begin with Le: '||:P145_TT||' ',
    P_SUBJ => 'Summary');
    3. A 'Button' to submit the process and (hopefully) send the message containing all users that adhere to the logic in the function.
    4. If I use 'return username from t1...' I will get a username generated, but like I said previously, it only gives me the first and does not loop.

  • About file uploading in bdc

    hi,
    what is the use of file uploading in bdc.
    i mean that how can i see that my file was updated or not.
    or where updation has happend using this files in both
    session method and call transaction method.
    i hope u can understood my problem.
    hoping for good answer.
    thanks

    TYPE-POOLS : TRUXS.
    TYPES : BEGIN OF TYP_OUT,
      PLVAR(2)  TYPE C,
      OTYPE(2)  TYPE C,
      SEARK(12) TYPE C,
      INFTY(4)  TYPE C,
      SUBTY(4)  TYPE C,
      ISTAT(1)  TYPE C,
      BEGDA(10) TYPE C,
      ENDDA(10) TYPE C,
      RSIGN(1)  TYPE C,
      RELAT(3)  TYPE C,
      SCLAS(2)  TYPE C,
      SOBID(45) TYPE C,
    END OF TYP_OUT.
    DATA : TA_PP02 TYPE STANDARD TABLE OF TYP_OUT INITIAL SIZE 0,
           WA_PP02 TYPE TYP_OUT.
    DATA: TA_EXCEL TYPE STANDARD TABLE OF ALSMEX_TABLINE INITIAL SIZE 0,
           WA_EXCEL TYPE ALSMEX_TABLINE.
    DATA : RAW_DATA TYPE TRUXS_T_TEXT_DATA.
    DATA: TA_BDCDATA TYPE STANDARD TABLE OF BDCDATA ,
           WA_BDCDATA TYPE BDCDATA,
           TA_BDCMESSAGE TYPE TABLE OF BDCMSGCOLL,
           WA_BDCMESSAGE TYPE BDCMSGCOLL.
    SELECTION-SCREEN : BEGIN OF BLOCK BLK1 WITH FRAME TITLE TEXT-001.
    PARAMETERS FILE_N TYPE RLGRAP-FILENAME OBLIGATORY." Path name selected by user with help of Filemngr
    SELECTION-SCREEN : END OF BLOCK BLK1 .
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR FILE_N.
    CALL FUNCTION 'F4_FILENAME'
    EXPORTING
    FIELD_NAME = 'FILE_N'
    IMPORTING
    FILE_NAME = FILE_N.
    START-OF-SELECTION.
    PERFORM UPLOAD.
    PERFORM BDC_OPEN.
    PERFORM BDC_SCREENS .
    PERFORM BDC_CLOSE.
    CALL TRANSACTION 'SM35'.
    *&      Form  UPLOAD
          text
    -->  p1        text
    <--  p2        text
    FORM UPLOAD .
    CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
      EXPORTING
      I_FIELD_SEPERATOR          =
      I_LINE_HEADER              =
        I_TAB_RAW_DATA             = RAW_DATA
        I_FILENAME                 = FILE_N
      TABLES
        I_TAB_CONVERTED_DATA       = TA_PP02[]
    EXCEPTIONS
       CONVERSION_FAILED          = 1
       OTHERS                     = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDFORM.                    " UPLOAD
    *&      Form  BDC_OPEN
          text
    -->  p1        text
    <--  p2        text
    FORM BDC_OPEN .
      CALL FUNCTION 'BDC_OPEN_GROUP'
       EXPORTING
         CLIENT                    = SY-MANDT
        DEST                      = FILLER8
         GROUP                     = 'PP02'
        HOLDDATE                  = FILLER8
         KEEP                      = 'X'
         USER                      = SY-UNAME
      IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    " BDC_OPEN
    *&      Form  BDC_SCREENS
          text
    -->  p1        text
    <--  p2        text
    FORM BDC_SCREENS .
      LOOP AT TA_PP02 INTO WA_PP02.
        REFRESH TA_BDCDATA.
        PERFORM BDC_DYNPRO      USING 'SAPMH5A0' '1000'.
        PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                      'PPHDR-ENDDA'.
        PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                      '/00'.
        PERFORM BDC_FIELD       USING 'PPHDR-PLVAR'
        WA_PP02-PLVAR.
                                 '01'.
        PERFORM BDC_FIELD       USING 'PPHDR-OTYPE'
        WA_PP02-OTYPE.
                                 'S'.
        PERFORM BDC_FIELD       USING 'PM0D1-SEARK'
        WA_PP02-SEARK.
        PERFORM BDC_FIELD       USING 'PPHDR-INFTY'
        WA_PP02-INFTY.
        PERFORM BDC_FIELD       USING 'PPHDR-SUBTY'
        WA_PP02-SUBTY.
        PERFORM BDC_FIELD       USING 'PPHDR-ISTAT'
        WA_PP02-ISTAT.
        PERFORM BDC_FIELD       USING 'PPHDR-BEGDA'
        WA_PP02-BEGDA.
        PERFORM BDC_FIELD       USING 'PPHDR-ENDDA'
        WA_PP02-ENDDA.
        PERFORM BDC_DYNPRO      USING 'SAPMH5A0' '1000'.
        PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                      'PPHDR-PLVAR'.
        PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                      '=INSE'.
        PERFORM BDC_FIELD       USING 'PPHDR-PLVAR'
        WA_PP02-PLVAR.
        PERFORM BDC_FIELD       USING 'PPHDR-OTYPE'
        WA_PP02-OTYPE.
        PERFORM BDC_FIELD       USING 'PM0D1-SEARK'
        WA_PP02-SEARK.
        PERFORM BDC_FIELD       USING 'PPHDR-INFTY'
        WA_PP02-INFTY.
        PERFORM BDC_FIELD       USING 'PPHDR-ISTAT'
        WA_PP02-ISTAT.
       PERFORM BDC_FIELD       USING 'PPHDR-BEGDA'
       WA_PP02-BEGDA.
       PERFORM BDC_FIELD       USING 'PPHDR-ENDDA'
       WA_PP02-ENDDA.
      PERFORM BDC_DYNPRO      USING 'MP100100' '2000'.
      PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                  'P1001-SOBID'.
      PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                  '/00'.
      PERFORM BDC_FIELD       USING 'P1001-BEGDA' WA_PP02-BEGDA.
                                 '01.12.2009'.
      PERFORM BDC_FIELD       USING 'P1001-ENDDA' WA_PP02-ENDDA.
                                 '31.12.9999'.
      PERFORM BDC_FIELD       USING 'P1001-RSIGN' WA_PP02-RSIGN.
                                 'A'.
      PERFORM BDC_FIELD       USING 'P1001-RELAT' WA_PP02-RELAT.
                                 '002'.
      PERFORM BDC_FIELD       USING 'P1001-SCLAS' WA_PP02-SCLAS.
                                 'S'.
      PERFORM BDC_FIELD       USING 'P1001-SOBID' WA_PP02-SOBID.
                                 '50001923'.
      PERFORM BDC_DYNPRO      USING 'MP100100' '2000'.
      PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                      'P1001-BEGDA'.
      PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                      '=UPD'.
      PERFORM BDC_DYNPRO      USING 'SAPMH5A0' '1000'.
      PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                     'PPHDR-PLVAR'.
      PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                      '=BACK'.
      CALL FUNCTION 'BDC_INSERT'
      EXPORTING
       TCODE                  = 'PP02'
       TABLES
        DYNPROTAB              = TA_BDCDATA.
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
       PERFORM BDC_TRANSACTION USING 'PP02'.
      ENDLOOP.
    PERFORM CLOSE_GROUP.
    ENDFORM.                    " BDC_SCREENS
    *&      Form  BDC_CLOSE
          text
    -->  p1        text
    <--  p2        text
    FORM BDC_CLOSE .
      CALL FUNCTION 'BDC_CLOSE_GROUP'
       EXCEPTIONS
         NOT_OPEN          = 1
         QUEUE_ERROR       = 2
         OTHERS            = 3
      IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    " BDC_CLOSE
    *& Form bdc_dynpro
    *text
    *-->P_1269 text
    *-->P_1270 text
    FORM BDC_DYNPRO USING PROGRAM TYPE SY-REPID
    DYNPRO TYPE ANY.
    WA_BDCDATA-PROGRAM = PROGRAM.
    WA_BDCDATA-DYNPRO = DYNPRO.
    WA_BDCDATA-DYNBEGIN = 'X'.
    APPEND WA_BDCDATA TO TA_BDCDATA.
    CLEAR WA_BDCDATA.
    ENDFORM. " bdc_dynpro
    **& Form bdc_field
    *text
    *-->P_1329 text
    *-->P_1330 text
    FORM BDC_FIELD USING FNAM TYPE ANY
    FVAL TYPE ANY.
    IF FVAL NE ''.
    WA_BDCDATA-FNAM = FNAM.
    WA_BDCDATA-FVAL = FVAL.
    APPEND WA_BDCDATA TO TA_BDCDATA.
    CLEAR WA_BDCDATA.
    ENDIF.
    ENDFORM. " bdc_field

  • File upload functionality in oracle portal server

    I have got a struts portlet on oracle portal server 9.0.4.My functionality is to have a file upload facility. I tried to achieve it , but problem arises when i use any pdk taglibs like
    <pdk-html:link page="/ShowInitialSupportScreen.do?action=initial&levelOfAction=3">
    after uploading when i forward to a result.jsp. and in that file if i use a tag like above, it gives null pointer exception because
    httpservletrequest.getAttribute(HttpCommonConstants.PORTLET_RENDER_REQUEST)
    this returns null when my enctype is multipart/form-data. in the fileupload.jsp
    and the in the internal implementation of the pdk taglib it refers to the PortletRenderRequest from httprequest object.
    The following link says multipart is not supported by the Parallel Page Engine.
    Re: multipart/form-data jsp
    Do you have any idea on this issue. File upload seems to be a basic functionality but doesnt the Oracle portal Server support it?
    With kind regards,
    -Rafeeq

    I got the solution, we cannot achive file upload in portal server cos it does not support Multi-part Data . instead i achieved it by a separate struts application to upload and invoked it from my portal application in an popup window.

  • Question about Custom Escalation Function

    I want to use a Custom Escalation Function described on this document:
    http://docs.tpu.ru/docs/oracle/en/owl/E14571_01/integration.1111/e10224/bp_workflow.htm#BACHEFDH
    I want to execute a custom function on task EXPIRATION.
    Main Question: The "Custom Escalation Function" is just for Escalation or i can use too for EXPIRATION ?
    Thanks.
    Victor Jabur

    Okay Experts. The problem is solved. There was no problem with the custom key figure function. The problem was with the sales order data. The sales order details for the material in question were under the "make to order" segment and the other transaction data info was in the "make to stock" segment.
    Once i found this out , i tried loading someother material and it worked perfectly.
    Thanks
    Aparna

  • Need Tutorial about file upload

    Hi folks!
    Have anybody a link or something else to a tutorial for uploading files with JSF?
    And i mean with the "plain" JSF RI 1.2 from Sun. Google gives me a lot of Websites with Apache myFaces and myfaces extensions, but i use facelets.
    So i have to bring all the the packages together and to mutch action for my little app.
    Greetings, cpt.crispy

    Using plain JSF RI 1.2 is not possible to do what you want.That's a pity!
    So, you need to use an additional component library
    like apache tomahawk.I know that. But what does the "additional component library" do?
    Don't misunderstand me please. I want to learn how file uploads works in JSF and J2EE, not to learn some "magic" libraries.
    For most Java problems you can get "additional libraries", but sometimes it's better you make it on your own to learn how it works.
    Thanks for your reply, cpt.crispy

  • Few questions about file sharing using airport

    I'm thinking about getting an AirPort Extreme, but I have a few questions:
    1- I (must) use Ubuntu Linux at work and I would like to be able to acess my home files hosted at AirPort remotly. Is this possible?
    2- Can I access my files on my iPhone using 3G connection (eg: download or stream mp3 files, photos, ...)?
    Thanks in advance!
    Marcio

    Yes.
    Yes. Use FileBrowser for iPad.

  • I have a question about the Siri function.

    Here in Belgium, we speak Dutch and also French and English. But I think when you use the Siri function it is always easier to use it with your own language ( Dutch). 28th October, the iphone4S will be launched here in Belgium, but only with a Englisch version of the Siri function. So my question is that you have any idea when te Dutch version will be available in Belgium, or when i buy an iphone 4S with English version that I can update it to a Dutch version when it will be launched..
    Thank you for helping
    Dylan

    Nobody here can tell you anything more about Apple's plans than what they have already publicly stated, which is that more languages were promised for later (including Japanese, Chinese, Korean, Italian, and Spanish in 2012).

  • Multiple Image File Upload for Creating Weblogs

    Maybe I just like pretty pictures more than most webloggers; but it seems like I spend a heck of a lot of time uploading images for my weblogs to SDN.  It would great if there was an easier way to do this.  Perhaps something as simple as uploading more than one image at a time.

    Hi Thomas,
    We will look into it. May be via a .zip file.
    Best, Mark.

  • Question about "share screen" function

    When I am watching at another persons screen, is there a way to hover your mouse over the remote computers window without it effecting the pointer on the remote computer?
    Thank you

    kevinmathie wrote:
    Hi all,
    I'm recording vocals on a song that has lots of ritardandi and rubato. While the vocalist is here, we'll be setting her part of the tempo mapping in "stone," so to speak, but not necessarily the instruments' tempo mapping between her verses or before her verses.
    I usually record this kind of thing in Digital Performer, because I know that the audio sticks like glue to any ritardando, accelerando, etc., I may put in after recording the audio.
    My question: Does the "Follow Tempo" box in Logic let me program in ritards after the audio is recorded, without messing up how the audio is synced to the sequence?
    Yes.
    In other words, if the audio region spans bars 12-24, and I plug in a big ritard at bar 15, followed by "a tempo" in 16 after the audio is recorded, will the audio region follow the tempo mapping?
    Yes.
    +"Plug in a big ritard"+ ? You are one tough composer!
    2nd question: Does it do it automatically? Or, like Digital Performer, do I need to tell it to follow the tempo mapping after I change tempo?
    No, it 'responds' to tempo events in the *tempo track*.
    Any other tips/suggestions regarding this function that you feel would be helpful for me?
    Yep, it can eat up RAM. When you enable follow tempo for a track, the whole audio file is loaded into RAM. Use a utility like MenuMeters to keep an eye on RAM use. http://www.pure-mac.com/diag.html#menumeters
    You can find all relevant info on pages 526-527 of the *Logic Pro 8 User Manual*.
    regards, Erik.

  • About file upload

    Hi all;
    I have problem which is i down load the image in my table when i upload it it give me error like forbidden 403.
    Please help me
    thanks.

    thanks Denes to get interested
    I can upload all the doc i want with less than a total cumulated size of 100Mo. But
    I think that i've found. After have try to change different values in the SGA and PGA parameters without result, i'm almost sure my problem comes from the size of my temporary tablespace. I'm not Oracle specialist and i didn't expect this tablespace was in use during this operation. I'll make some tests but it should be work if i increase this buffer. But i don't understand, for downloading blob with 4Go size, do you have to fix temp tablespace size to 4Go?
    For those who could be interested, there is my code (don't be afraid, there is a lot of comments):
    [package client;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.InputStream;
    import java.sql.Connection;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import java.sql.Statement;
    public class DocBlobData {
        public DocBlobData(String location, Log myLog, Integer IdBlob) {
            myLog.lineWriter("**********************************************");
            myLog.lineWriter("********** START document uploading **********");
            try {
                upLoadFile(location, myLog, (blobDocQuery(myLog, IdBlob)));
                myLog.lineWriter("****** COMPLETE upload of this document ******");
                myLog.lineWriter("**********************************************");
            } catch (Exception e) {
    myLog.lineWriter("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
    myLog.lineWriter("!!!!!!!! ERROR during upload operation !!!!!!!");
    myLog.lineWriter("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
    * Take a document find at "location" then execute the query passed
    * as parameter for insert or update a blob into the database
    public static void upLoadFile(String location, Log myLog,
    String query) throws Exception {
    Connection conn = Log.oracleConnectionCreation();
    File myFile = new File(location.toLowerCase());
    InputStream myFileInStream = new FileInputStream(myFile);
    try {
    PreparedStatement ps = conn.prepareStatement(query);
    try {
    ps.setBinaryStream(1, myFileInStream, (int)myFile.length());
    ps.executeUpdate();
    myLog.lineWriter("following file has been uploaded");
    myLog.lineWriter("from :", myFile.getAbsolutePath());
    myLog.lineWriter("name :", myFile.getName());
    } catch (Exception e) {
    myLog.lineWriter("!!!!!!!!!! ERROR with following file !!!!!!!!!");
    myLog.lineWriter("from :", myFile.getAbsolutePath());
    myLog.lineWriter("name :", myFile.getName());
    } finally {
    ps.close();
    } finally {
    myFileInStream.close();
    conn.close();
    * Return the query "insert..." when the ID proposed doesn't already exist
    * and return "update..." if the needed ID already exists
    public static String blobDocQuery(Log myLog, Integer Id) throws Exception {
    Connection conn = Log.oracleConnectionCreation();
    String tableDoc = "DOC_BLOB";
    String columnDoc = "ABLOB";
    String id_columnDoc = "ID_BLOB";
    Integer idDoc = Id;
    String upDateDoc =
    "update " + tableDoc + " set " + id_columnDoc + " = " + idDoc +
    ", " + columnDoc + " = ? where " + id_columnDoc + " = " + idDoc;
    String insertDoc =
    "insert into " + tableDoc + " (" + id_columnDoc + ", " +
    columnDoc + ")" + " values " + "(" + idDoc + ", ?)";
    String testQuery =
    "select * from " + tableDoc + " where " + id_columnDoc + " = " +
    idDoc;
    try {
    Statement ps = conn.createStatement();
    ResultSet result = ps.executeQuery(testQuery);
    if (result.next()) {
    /* myLog.lineWriter("The query returned by blobDocQuery is :" +
    upDateDoc); */
    return upDateDoc;
    } else {
    /* myLog.lineWriter("The query returned by blobDocQuery is :" +
    insertDoc); */
    return insertDoc;
    } finally {
    conn.close();
    * Take a repertory path then found the document details in function of its ID
    * finally download the document into the repertory from the blob
    * and name it with the pattern "type_name.extension"
    public static void downloadFile(Log myLog, String location,
    Integer Id) throws Exception {
    Connection conn = Log.oracleConnectionCreation();
    String table = "DOC_BLOB"; // Table for storing the Blob
    String column = "ABLOB"; // Column for storing the Blob
    String id_column = "ID_BLOB"; // Column for storing the Id
    Integer id = Id; // Fix the id wanted
    location =
    location + "/" + DocDetailData.findTypefromBlobId(myLog, id) +
    "_" + DocDetailData.findNamefromBlobId(myLog, id) +
    DocDetailData.findExtensionfromBlobId(myLog, id);
    File myFile = new File(location.toLowerCase());
    FileOutputStream myFileOutStream = new FileOutputStream(myFile);
    myLog.lineWriter("**********************************************");
    myLog.lineWriter("********* START document downloading *********");
    try {
    String request =
    "select " + column + " from " + table + " where " + id_column +
    " = ? ";
    PreparedStatement ps = conn.prepareStatement(request);
    try {
    ps.setInt(1, id);
    ResultSet rs = ps.executeQuery();
    try {
    if (rs.next()) {
    InputStream myFileInStream =
    rs.getBinaryStream(column);
    byte[] buffer = new byte[1024];
    int length = 0;
    while ((length = myFileInStream.read(buffer)) != -1) {
    myFileOutStream.write(buffer, 0, length);
    myLog.lineWriter("***** COMPLETE download of this document *****");
    myLog.lineWriter("**********************************************");
    } finally {
    rs.close();
    } finally {
    ps.close();
    } finally {
    myFileOutStream.close();
    conn.close();
    * This main is used for testing purposes
    public static void main(String[] args) {
    Log myLog =
    Log.myLogCreation("c:/Migration Logs/", "Test_DocBlobData.log");
    Integer idEntryBlob =
    1; // Fix the Id used into the database for the Blob
    // Uncomment the following lines for testing the function blobDocQuery(Log,Integer)
    /* try {
    blobDocQuery(myLog, idEntryBlob);
    } catch (Exception f) {
    myLog.lineWriter("!!! ERROR during execution of blobDocQuery");
    // Uncomment the following lines for testing the function upLoadFile(String,Log,String)
    // You must create a document text using Notepad at the root of C with name "test"
    /* try {
    upLoadFile("c:\\image_vide.GIF", myLog, "update DOC_BLOB set ID_BLOB = 1, ABLOB = ? where ID_BLOB = 1");
    //"insert into DOC_BLOB (ID_BLOB, ABLOB) values ( 1, ?)");
    } catch (Exception f) {
    myLog.lineWriter("!!! ERROR during execution of upLoadFile");
    /* try {
    downloadFile(myLog, "c:/", 1);
    } catch (Exception e) {
    myLog.lineWriter("!!! ERROR during execution of downloadFile");
    I add just this function quite useful in my case, which enables to circulate through a folder arborescence :
    * Enable to progress through a complexe directory and each one of its dependences
    * All the documents found into this directory are uploaded into the database
    * Their details are loaded too with keeping link between the doc and its details
    public void parseFilesNUpLoad(File rootFolder,
    Log myLog) throws Exception {
    myLog.lineWriter("the root folder is : ",
    rootFolder.getAbsolutePath());
    if (rootFolder.isDirectory()) {
    File[] list = rootFolder.listFiles();
    if (list != null) {
    for (int i = 0; i < list.length; i++) {
    parseFilesNUpLoad(list[i], myLog);
    if (list[i].isFile()) {
    DocBlobData blobTest =
    new DocBlobData(list[i].getAbsolutePath(), myLog,
    idEntryBlob);
    myLog.lineWriter(" ");
    DocDetailData detailTest =
    new DocDetailData(list[i].getAbsolutePath(), myLog,
    idEntryBlob, idEntryDetails);
    myLog.lineWriter(" ");
    idEntryBlob = idEntryBlob + 1;
    idEntryDetails = idEntryDetails + 1;
    } else {
    myLog.lineWriter("parseFilesNUpLoad",
    "!!! CRITICAL ERROR with the root folder at : " +
    rootFolder.getAbsolutePath());
    And the last one, for populating the log and create the connection to the DB
    [package client;
    import java.io.BufferedWriter;
    import java.io.File;
    import java.io.FileWriter;
    import java.io.IOException;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.text.DateFormat;
    import java.util.Calendar;
    import java.util.Date;
    import java.util.Locale;
    public class Log {
        private String fileName;
        public Log(String name) {
            this.fileName = name;
    public void lineWriter(String line) {
    try {
    FileWriter f = new FileWriter(fileName, true);
    BufferedWriter bf = new BufferedWriter(f);
    Calendar c = Calendar.getInstance();
    Date now = c.getTime();
    String dateLog =
    DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM,
    Locale.FRANCE).format(now);
    bf.write("[" + dateLog + "] :" + line);
    bf.newLine();
    bf.close();
    } catch (IOException e) {
    System.out.println(e.getMessage());
    public void lineWriter(String header, String info) {
    lineWriter(header + " > " + info);
    public void lineWriter(String header, Long info) {
    lineWriter(header + " > " + info);
    public static Log myLogCreation(String location, String name) {
    boolean exists = (new File(location)).exists();
    if (!exists) {
    (new File(location)).mkdirs();
    Log myLog = new Log(location + name);
    return myLog;
    public static Connection oracleConnectionCreation() throws Exception {
    // Register the Oracle JDBC driver
    DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
    //connecting to the DB
    Connection conn =
    DriverManager.getConnection("jdbc:oracle:thin:@192.192.20.1:1521:DFLY",
    "DFLYDB", "DFLYDB");
    // DriverManager.getConnection("jdbc:oracle:thin:@192.192.20.1:1521:DFLY", "DFLYDB", "DFLYDB");
    return conn;
    cheers,
    Tif

Maybe you are looking for