TransactionScope problem with Oracle 11g

1,045 views
Skip to first unread message

sudip

unread,
Sep 21, 2010, 8:34:31 PM9/21/10
to nhusers
The following code snippet works fine with SQL Server 2008 (SP1) but
with Oracle 11g the call to session.BeginTransaction() throws an
exception with the message ‘Connection is already part of a local or
a distributed transaction’ (stack trace shown below). Using the
'"NHibernate.Driver.OracleDataClientDriver".

Has anyone else run into this?

using (var scope = new TransactionScope())
{
using (var session = sessionFactory.OpenSession())
using (var transaction = session.BeginTransaction())
{
// do what you need to do with the session
transaction.Commit();
}
scope.Complete();
}


Exception at: at
NHibernate.Transaction.AdoTransaction.Begin(IsolationLevel
isolationLevel)
at NHibernate.Transaction.AdoTransaction.Begin()
at NHibernate.AdoNet.ConnectionManager.BeginTransaction()
at NHibernate.Impl.SessionImpl.BeginTransaction()
at
MetraTech.BusinessEntity.DataAccess.Persistence.StandardRepository.SaveInstances(List`1&
dataObjects) in S:\MetraTech\BusinessEntity\DataAccess\Persistence
\StandardRepository.cs:line 3103

Inner error message was: Connection is already part of a local or a
distributed transaction
Inner exception at: at
Oracle.DataAccess.Client.OracleConnection.BeginTransaction(IsolationLevel
isolationLevel)
at
Oracle.DataAccess.Client.OracleConnection.BeginDbTransaction(IsolationLevel
isolationLevel)
at
System.Data.Common.DbConnection.System.Data.IDbConnection.BeginTransaction()
at NHibernate.Transaction.AdoTransaction.Begin(IsolationLevel
isolationLevel)

Fabio Maulo

unread,
Sep 22, 2010, 5:33:20 AM9/22/10
to nhu...@googlegroups.com
I would read the specifications of DP to understand why two DP should
have so different behavior and then understand where create the issue
ticket (at Microsoft or at Oracle).

--
Fabio Maulo

> --
> You received this message because you are subscribed to the Google Groups "nhusers" group.
> To post to this group, send email to nhu...@googlegroups.com.
> To unsubscribe from this group, send email to nhusers+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.
>

Juan

unread,
Sep 22, 2010, 8:05:07 AM9/22/10
to nhusers
Read throw the following post (and comments). You will find some
issues and current usage pattern for oracle + NH + transaction scope

http://davybrion.com/blog/2010/05/avoiding-leaking-connections-with-nhibernate-and-transactionscope/
Reply all
Reply to author
Forward
0 new messages