0 Replies Latest reply on Nov 22, 2006 6:28 AM by Roberto Simoni

    Executing a jdbc statement in a session (XACT_ABORT issue)..

    Roberto Simoni Newbie

      Hi, we have a problem:

      we have a SQL Server DB with internally linked a remote oracle DB.
      We have created views in out SQL Server DB to map remote oracle tables.
      When we try an insert sql on the SQL Server Enterprise Manager on the views all run correctly.

      When we use EJB 3.0 to execute the same insert (via persist method) we receive this error:


      Unable to start a nested transaction for OLE DB provider 'MSDAORA'. A nested transaction was requir
      ed because the XACT_ABORT option was set to OFF"



      we have read that linked server in sql server are provided by a Provider that if doesn't support nested transactions you have to explicitly execute a query:

      SET XACT_ABORT ON


      How can we execute this statement in EJB 3.0?
      createQuery, createNativeQuery doesn't seem to be the solution
      How can I obtain the connection used in the "session" to run a simply JDBC statement?
      Do you have another solution?

      Thanks
      Bye