Page 1 of 1

LINQ for oracle with MS DTC raise exeption "ORA-02045"

Posted: Wed 07 Apr 2010 13:17
by mineevev
Hello!

I used in my application MS DTC and LINQ.
When ling try open session more 30 in global transaction:
Devart.Data.Linq.LinqCommandExecutionException was unhandled by user code
Message="Error on opening DbConnection."
Source="Devart.Data.Linq"
StackTrace:
at Devart.Data.Linq.LinqCommandExecutionException.a(String A_0, Exception A_1)
at Devart.Data.Linq.Provider.ConnectionManager.GetOpenConnection()
at Devart.Data.Linq.Provider.ConnectionManager.b(IConnectionUser A_0)
at Devart.Data.Linq.Provider.DataProvider.a(c A_0, Object[] A_1, Object[] A_2, Object A_3)
at Devart.Data.Linq.Provider.DataProvider.a(c A_0, Object[] A_1)
at Devart.Data.Linq.Provider.DataProvider.h(Expression A_0)
at Devart.Data.Linq.DataQuery`1.System.Linq.IQueryProvider.Execute[S](Expression expression)
at System.Linq.Queryable.FirstOrDefault[TSource](IQueryable`1 source)
at NetSqlAzMan.SqlAzManApplication.GetItem(String itemName) in C:\~\NetSqlAzMan\NetSqlAzMan\SqlAzManApplication.cs:line 332
at

InnerException: Devart.Data.Oracle.OracleException
Message="ORA-02045: too many local sessions participating in global transaction"
Source="Devart.Data.Oracle"
ErrorCode=-2147467259
Code=2045
Offset=0
StackTrace:
at Devart.Data.Oracle.bq.b(Int32 A_0)
at Devart.Data.Oracle.as.c(Int32 A_0)
at Devart.Data.Oracle.as.a(Guid A_0, IsolationLevel A_1)
at Devart.Data.Oracle.OracleInternalConnection.BeginTransaction(Guid distributedIdentifier, IsolationLevel isolationLevel)
at Devart.Common.h.a(Guid A_0)
at Devart.Common.DbConnectionInternal.EnlistToDistributedTransaction(Transaction transaction)
at Devart.Common.DbConnectionInternal.c()
at Devart.Common.DbConnectionInternal.h()
at Devart.Common.DbConnectionFactory.a(DbConnectionBase A_0)
at Devart.Common.DbConnectionClosed.Open(DbConnectionBase outerConnection)
at Devart.Common.DbConnectionBase.Open()
at Devart.Data.Oracle.OracleConnection.Open()
at Devart.Data.Linq.Provider.ConnectionManager.GetOpenConnection()




I try set MaxUsedConnections = 1 in DataContext .... this didn't help

This problem is resolved

Posted: Wed 07 Apr 2010 15:46
by mineevev
In connection string need to add: Enlist=true;

Enlist={true | false}. Specifies whether the data provider automatically attempts to enlist the connection in creating the thread's current transaction context. This option is valid only when the data provider is installed with a Server license and the optional MS DTC Support components were installed.
When set to false (the initial default), the data provider does not automatically attempt to enlist the connection.

Posted: Mon 12 Apr 2010 12:04
by AndreyR
The Enlist functionality is already implemented. You can create the DataContext instance using the new OracleConnection object that was created with Enlist set to false.
The ORA-02045 exception is expected in case when one has too many connections taking part in global distributed transaction, this is an Oracle limitation.
As for the MaxUsedConnections property, it is not supposed to control the number of connections in the transaction.
The MaxUsedConnection property controls the maximum number of connections to be opened while DataContext is querying the database.
By default we open several connections because of performance.

Posted: Mon 14 Nov 2011 17:01
by axitte
hi mineevev, I'm planning to use Devart with NetSqlAzman. Is it possible to ask few questions regarding the integration? Thanks in advance.

Posted: Thu 17 Nov 2011 17:18
by StanislavK
axitte, feel free to ask your questions at this forum. If you encounter any problems when working with Devart products, please describe them so that we are able to suggest a solution.