4 Replies Latest reply on May 15, 2004 12:31 AM by Juha Lindfors

    transaction problem

    zhangj Newbie

      I have a jsp call stateless session ejb method,in the method,it call a stored procedure,the stored procedure call
      and update some tables.

      since use user doesn't have permit to access master database,the
      failed.but the tables updated

      I set the ejb and method have transaction attribute as "required",if the part of store procedure failed,why the container didn't roll back the transaction?

        • 1. Re: transaction problem
          zhangj Newbie

          ps:I'm using MS sql server 2000, and master..xp_cmdshell execute a bcp command,copy from table to a file

          • 2. Re: transaction problem
            Juha Lindfors Master

            If the user did not have permit to access the database, how did the tables update in the first place?

            Anyway, if you're getting a checked exception (application exception) and catching it, you need to setRollbackOnly() on the EJB context to roll back the transaction.

            • 3. Re: transaction problem
              zhangj Newbie

              Thank you for reply.
              basicly,this stored procedure update current database,then use xp_cmdshell which is in master database to export table to a file.I'm using MS sql server 2000.the data in current database updated but use has no access to master database.
              I'm using container managed transaction,
              I think the application server should be able to control transactions,transaction control is one of benefit using EJB?why I have explicate say setRollbackOnly()?

              • 4. Re: transaction problem
                Juha Lindfors Master

                Because the spec says application exceptions are not automatically rolled back.