{"Unable to get error message (161) (0)."} ?? in TransactionScope

Proposed {"Unable to get error message (161) (0)."} ?? in TransactionScope

  • Tuesday, August 14, 2012 10:38 AM
     
     

    Hi.

    i am unable to open Oracle connection inside TransactionScope.

    Oracle server is installed in Windows 2003 SP2 Machine.

    In My client Place i am using Windows 7 OS and .Net 3.5.and i have installed OracleClient ..
    I am trying to connect to Server but i am unable to open Connection.

    Code :

    //SecurityConnectionString=Data Source=TestDB;Persist Security Info=True;User ID=TEST$SECURITY;Password=TESTSECURITY;Unicode=True

    using (System.Transactions.TransactionScope transaction = new System.Transactions.TransactionScope(System.Transactions.TransactionScopeOption.Required))
    {
    using (OracleConnection Con = new OracleConnection(SecurityConnectionString))
    {

    if (Con.State == ConnectionState.Closed)
    Con.Open(); //Unhandled Oracle Exception Occurs Here

    //Here My Program Logic Goes
    }
    }

    Even i have changed Microsoft Distributed Transaction Cordinator Settings.
    i.e DTC->Security->Network DTC access Enabled. 

    But still i have problem.

    Same Code is working on Windows XP SP1.but not on Windows 7.

    Actual Error i am getting is 

    System.Data.OracleClient.OracleException : {"\0"}

    Code=161

    Source=System.Data.OracleClient;

    StackTrace="   at System.Data.OracleClient.OciEnlistContext.Join(OracleInternalConnection internalConnection, Transaction indigoTransaction)\r\n   at System.Data.OracleClient.OracleInternalConnection.Enlist(String userName, String password, String serverName, Transaction transaction, Boolean manualEnlistment)\r\n   at System.Data.OracleClient.OracleInternalConnection.Activate(Transaction transaction)\r\n   at System.Data.ProviderBase.DbConnectionInternal.ActivateConnection(Transaction transaction)\r\n   at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)\r\n   at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)\r\n   at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)\r\n   at System.Data.OracleClient.OracleConnection.Open()\r\n   at UDTOOL_1._0.LoginForm.btnLogin_Click(Object sender, EventArgs e) in C:\\Users\\sagar\\Desktop\\UDTOOL 1.0\\UDTOOL 1.0\\LoginForm.cs:line 196\r\n   at System.Windows.Forms.Control.OnClick(EventArgs e)\r\n   at System.Windows.Forms.Button.OnClick(EventArgs e)\r\n   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)\r\n   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)\r\n   at System.Windows.Forms.Control.WndProc(Message& m)\r\n   at System.Windows.Forms.ButtonBase.WndProc(Message& m)\r\n   at System.Windows.Forms.Button.WndProc(Message& m)\r\n   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)\r\n   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)\r\n   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)\r\n   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)\r\n   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)\r\n   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)\r\n   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)\r\n   at System.Windows.Forms.Application.Run(Form mainForm)\r\n   at UDTOOL_1._0.Program.Main() in C:\\Users\\sagar\\Desktop\\UDTOOL 1.0\\UDTOOL 1.0\\Program.cs:line 29\r\n   at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)\r\n   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)\r\n   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()\r\n   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)\r\n   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)\r\n   at System.Threading.ThreadHelper.ThreadStart()"


    Please Help......

All Replies

  • Tuesday, August 14, 2012 5:02 PM
     
     

    Is your app running 64-bit on Windows 7?


    Paul ~~~~ Microsoft MVP (Visual Basic)

  • Wednesday, August 22, 2012 7:37 AM
     
     
    Hi  NRKbangalore,

    I have same probrem.

    Code:
    (I wrote like NRKbangalore's code)

            Using t As System.Transactions.TransactionScope = New System.Transactions.TransactionScope(System.Transactions.TransactionScopeOption.Required)

                Try
                    Using con As Oracle.DataAccess.Client.OracleConnection = New Oracle.DataAccess.Client.OracleConnection("connectionstring hoge")
                        con.Open() ' Unhandled Oracle Exception Occurs Here
                        con.Close()
                    End Using
                Catch ex As Exception
                    t.Dispose()
                End Try

            End Using

    This code is working on XP mode (in windows 7 OS). 
    but not working on Windows 7.

    In My client Place I am using Windows7 OS and .NET 4.0
    I have installed OracleClient(ver 10.2) and  ODP.NET(ver 10.2).
    (I use Oracle.DataAccess.dll.)
    Windows7 OS is Configured Microsoft Distributed Transaction Cordinator Settings .

    (XP mode is not configured)

    Actual Error I am getting is

    ErrorCode=-2147467259

    StackTrace=
       場所 Oracle.DataAccess.Client.OracleException.HandleErrorHelper(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src, String procedure)
       場所 Oracle.DataAccess.Client.OracleException.HandleError(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, Object src)
       場所 Oracle.DataAccess.Client.OracleConnection.Open()
       場所 ...(My project's Function name)


    Please Help....me too...
  • Wednesday, August 22, 2012 7:42 AM
     
     

    i'm sorry. 

    i forgot to write.

    my app is running 32-bit on Windows7.

  • Tuesday, August 28, 2012 5:08 AM
     
      Has Code

    i wrote like this.

    i use OracleTransaction and new OracleConnection.

    i dont use TransactionScope.

    this code is working on win7.

            
            Dim con As New OracleConnection(DBConString)
            con.Open()
            Dim tr As OracleTransaction = con.BeginTransaction
            Try
                For i = 0 To _adpList.Count - 1
                    _adpList(i).DeleteCommand.Connection = con
                    _adpList(i).InsertCommand.Connection = con
                    _adpList(i).Update(HogeDataSet.Tables(i))
                Next
                tr.Commit()
            Catch ex As Exception
                tr.Rollback()
            Finally
                con.Close()
            End Try
                      

  • Friday, September 21, 2012 6:40 AM
     
     

    NRKbangalore

    are you fixed it ? i have the same problem, my local workspace is  using  oracle 11.1.0.6.0  ,Windows 7 32bit , VS 2008, the remote DBServer is  windows 2003 , using oracle 11.1.0.6.0 ,can you help me ? thanks 


    i like “job”

  • Saturday, September 22, 2012 7:16 AM
     
     Proposed
    hi, i fixed it ,  it is simple , just use windows XP ,everything is ok

    i like “job”

    • Proposed As Answer by kyk_nk Monday, January 07, 2013 2:49 PM
    •