Results 1 to 10 of 10
  1. #1
    Join Date
    Aug 2009
    Posts
    7

    Unanswered: transaction and upload opration

    Hi !
    I encounter a problem about the file upload proccess in a db transaction.
    Here is the detail.
    Step 1:
    receive request for uploading opration
    Step 2:
    store the meta data with the file into db
    Step 3:
    upload file to the file server
    the question is
    can i use one transaction for step 2 and step 3?
    what is the shortage and advatage?
    If not , what is the case?

    Thanks
    Ray

  2. #2
    Join Date
    Dec 2003
    Posts
    1,074
    Transactions, as far as being able to use Oracle's built-in COMMIT or ROLLBACK, are tied directly to INSERT, UPDATE & DELETE statements. Any other action you perform (file moves, etc) are not included. You would have to specifically code some type of "rollback" equivalent. --=cf

  3. #3
    Join Date
    Nov 2003
    Posts
    2,934
    Provided Answers: 12
    Quote Originally Posted by sangeshitou
    can i use one transaction for step 2 and step 3?
    Only if you store the file in the database and not on the file server

  4. #4
    Join Date
    Aug 2009
    Posts
    7
    Sorry,I think there may be some mistakes.
    First, the transaction i mentioned above is not the transaction in DB. It may be the transaction outside the DB, for instance, the JTA. In addition,the JTA can rollback the DBoperation.

    Here is a simple introduction to JTA.
    JTA Transactions (The Java EE 6 Tutorial, Volume I) - Sun Microsystems

    The key point of my question is that if i do a file upload operation in one transaction using JTA with the db operation for storing meta data, it would cause what problems.

  5. #5
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    >Sorry,I think there may be some mistakes.
    If you claim to know the answer, why are you here asking questions?

    >First, the transaction i mentioned above is not the transaction in DB.
    Then this has nothing to do with Oracle, so why are you here asking questions?

    >It may be the transaction outside the DB, for instance, the JTA. In addition,the JTA can rollback the DBoperation.
    Then this has nothing to do with Oracle, so why are you here asking questions?

    >if i do a file upload operation in one transaction using JTA with the db operation for storing meta data, it would cause what problems.
    Oracle does not really know or care much what is stored in it.
    As far as unspecified possible "problems", we obviously do not know enough about your environment or requirements to provide meaningful response.

    >upload file to the file server
    Please clarify what this step has to do with Oracle RDBMS
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  6. #6
    Join Date
    Aug 2009
    Posts
    7
    My application is a web application.
    Here is a file upload operation.
    To complish that, follow step will be done:

    step 1:
    upload a file to a file server,not into database.

    step 2:
    store some meta data like file name ,the size of the file ,upload time, reduce the remain space for the account and so on
    into database such as oracle.

    To put step 1 and step 2 into one transaction guarantees that when step 1 fails, step 2 will roll back.

    Now comes the question:
    what is the disadvatages or advantages?
    If not, as use tow transactions for step 1 and step 2,then what is the disadvatages or advantages?

    Thanks!
    Ray

  7. #7
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    >To put step 1 and step 2 into one transaction guarantees that when step 1 fails, step 2 will roll back.

    The actions are under your control.
    if/when step #1 fails, why would the application proceed to start step #2?
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  8. #8
    Join Date
    Aug 2009
    Posts
    7
    Suppose that
    in the first place , i store the meta data into db say oracle.
    Then procced to upload files to file server.
    I should roll back the operation which store meta data.

    If i do the two things--uploading and storing in one transaction,
    it will cause what problems?


    Thanks!
    Ray

  9. #9
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    >I should roll back the operation which store meta data.
    yes

    >it will cause what problems?
    Not for Oracle
    Last edited by anacedent; 08-14-09 at 00:21.
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  10. #10
    Join Date
    Aug 2009
    Posts
    7
    GOT IT.
    Thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •