Oracle Error 01453 When Using Entity Framework

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
daveoggy
Posts: 14
Joined: Fri 23 Jan 2009 18:15

Oracle Error 01453 When Using Entity Framework

Post by daveoggy » Fri 23 Jan 2009 18:35

Hi

I use the following function to save changes made to my detached entity objects. I have multiple threads running and I quickly run out of database connections if I don't use the mutex.

Code: Select all

        public static void SaveFlashnetChanges(EntityKey ek, EntityObject FlashNetObject)
        {
            mtx1.WaitOne();
            using (Entities ent = new Entities(EntitySharedConnection.SharedConnection))
            {
                object FNET_ORIG = null;
                try
                {
                    if (ent.TryGetObjectByKey(ek, out FNET_ORIG))
                    {
                        ent.ApplyPropertyChanges(ek.EntitySetName, FlashNetObject);
                    }
                    ent.SaveChanges();
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }
            mtx1.ReleaseMutex();
        }
The application runs fine for a while until I eventually get the following error:

Code: Select all

Unhandled Exception: System.Data.EntityException: An error occurred while starting a transaction on the provider connection. See the inner exception for details. ---> Devart.Data.Oracle.OracleException: ORA-01453: SET TRANSACTION must be first statement of transaction
   at Devart.Data.Oracle.al.b(Int32 A_0)
   at Devart.Data.Oracle.an.e(Int32 A_0)
   at Devart.Data.Oracle.an.a(Int32 A_0, a1 A_1)
   at Devart.Data.Oracle.OracleCommand.a(CommandBehavior A_0, IDisposable A_1, Int32 A_2, Int32 A_3)
   at Devart.Common.DbCommandBase.ExecuteDbDataReader(CommandBehavior behavior)
   at System.Data.Common.DbCommand.ExecuteReader()
   at Devart.Data.Oracle.OracleCommand.ExecuteNonQuery()
   at Devart.Data.Oracle.OracleTransaction..ctor(OracleConnection A_0, IsolationLevel A_1)
   at Devart.Data.Oracle.OracleConnection.BeginTransaction(IsolationLevel il)
   at Devart.Data.Oracle.OracleConnection.b(IsolationLevel A_0)
   at System.Data.Common.DbConnection.BeginTransaction(IsolationLevel isolationLevel)
   at System.Data.EntityClient.EntityConnection.BeginDbTransaction(IsolationLevel isolationLevel)
   --- End of inner exception stack trace ---
   at System.Data.EntityClient.EntityConnection.BeginDbTransaction(IsolationLevel isolationLevel)
   at System.Data.Common.DbConnection.BeginTransaction()
   at System.Data.EntityClient.EntityConnection.BeginTransaction()
   at System.Data.Objects.ObjectContext.SaveChanges(Boolean acceptChangesDuringSave)
   at System.Data.Objects.ObjectContext.SaveChanges()
   at ConsoleApplication1.Program.SubmitNewTasks() in C:\Projects\ConsoleApplication1.EntityData\ConsoleApplication1\Program.cs:line 41
   at ConsoleApplication1.Program.Main(String[] args) in C:\Projects\ConsoleApplication1.EntityData\ConsoleApplication1\Program.cs:line 21
If the number of threads accessing the function is kept low (<10) things seem to be stable, only when the thread count goes up do I encounter problems.

Can anyone help?

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Mon 26 Jan 2009 11:54

Could you please send me (andreyr * devart * com) a small test project illustrating the problem? Include the DB script of the objects you use in it.

HintonBR
Posts: 24
Joined: Mon 16 Jun 2008 17:07

Any Update on this

Post by HintonBR » Mon 27 Apr 2009 16:32

we are seeing the same problem and wondered if a solution to this had been found as it describes our situation exactly
________
Built Tough Series
Last edited by HintonBR on Tue 15 Feb 2011 11:55, edited 1 time in total.

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Tue 28 Apr 2009 08:11

Please check that your code does not use the same OracleConnection object by several threads simultaneously.
DbConnection object can't be thread-safe.

Post Reply