locked
Windows 8, Visual Studio 2012 and Oracle RRS feed

  • Question

  • I am a learning developer.  I have a project of Oracle Databases to work on and the instructor wants it to be done with VS12 (Visual Studio 2012). I am using windows 8 professional, and facing problems with the connectivity.

    I am constantly getting the errors that are beyond my understanding.

    This warning

    Warning	1	There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "Oracle.Web, Version=2.112.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=x86", "x86". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project.	finalProjectDB
    

    and these errors

    [BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)]
       System.Data.Common.UnsafeNativeMethods.OCILobCopy2(IntPtr svchp, IntPtr errhp, IntPtr dst_locp, IntPtr src_locp, UInt64 amount, UInt64 dst_offset, UInt64 src_offset) +0
       System.Data.OracleClient.OCI.DetermineClientVersion() +126
    
    [InvalidOperationException: Attempt to load Oracle client libraries threw BadImageFormatException.  This problem will occur when running in 64 bit mode with the 32 bit Oracle client components installed.]
       System.Data.OracleClient.OCI.DetermineClientVersion() +586
       System.Data.OracleClient.OracleInternalConnection.OpenOnLocalTransaction(String userName, String password, String serverName, Boolean integratedSecurity, Boolean unicode, Boolean omitOracleConnectionName) +37
       System.Data.OracleClient.OracleInternalConnection..ctor(OracleConnectionString connectionOptions) +129
       System.Data.OracleClient.OracleConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject) +40
       System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +31
       System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +548
       System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +69
       System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +470
       System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +108
       System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +118
       System.Data.OracleClient.OracleConnection.Open() +43
       System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +121
       System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +316
       System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) +86
       System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +1482
       System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +21
       System.Web.UI.WebControls.DataBoundControl.PerformSelect() +138
       System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +30
       System.Web.UI.WebControls.GridView.DataBind() +4
       System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +105
       System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +75
       System.Web.UI.Control.EnsureChildControls() +83
       System.Web.UI.Control.PreRenderRecursiveInternal() +42
       System.Web.UI.Control.PreRenderRecursiveInternal() +168
       System.Web.UI.Control.PreRenderRecursiveInternal() +168
       System.Web.UI.Control.PreRenderRecursiveInternal() +168
       System.Web.UI.Control.PreRenderRecursiveInternal() +168
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +974
    

    I, at sometimes, also get the errors about things that I am using an OS of 64 bit and Oracle is of 32 bit but this error come sometimes not always.

    Can somebody help me with this error?

    • Moved by Mike Feng Thursday, January 3, 2013 2:56 AM restructure .NET forums (From:.NET Platform Architecture Development Discussions)
    Tuesday, December 25, 2012 3:10 PM

Answers

  • There many ways to solve your issue.

    Option One: As your project is using a 32 bit oracle component, you can build your project to use 32 bit processor architecture. To do that you need to change your platform Target to x86 (Project Properties->Build-> Platform Target)

    Option Two: Install and use 64 bit ODAC (Oracle Data Access) from here. And Compile your project with Any CPU option of platform Target. But you need to make sure that, if your project is going to run on a 32 bit computer – you need to install 32 bit of ODAC on that system. To understand more on .NET Platform Target refer this.

    Option Three: I am not sure your project type is of Web Application or a windows application. If it is a web application you can control this at IIS itself my setting the associated application pool of your web site to run on 32 bit mode. i.e ApplicationPool->Enable 32-bit mode=true.


    Lingaraj Mishra

    • Marked as answer by InformationBlackHole Wednesday, December 26, 2012 1:46 PM
    • Unmarked as answer by InformationBlackHole Wednesday, December 26, 2012 3:03 PM
    • Proposed as answer by Mike Feng Thursday, December 27, 2012 2:13 AM
    • Marked as answer by Mike Feng Tuesday, January 8, 2013 6:10 AM
    Wednesday, December 26, 2012 8:28 AM

All replies

  • Hi Allah,

    When you test this Web project on Win8 64bit, please provide x64 Oracle connection assembly. Because the IIS will start 64bit process by default. For more information, you can try http://forums.iis.net/ 

    Best regards,


    Mike Feng
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, December 26, 2012 3:27 AM
  • There many ways to solve your issue.

    Option One: As your project is using a 32 bit oracle component, you can build your project to use 32 bit processor architecture. To do that you need to change your platform Target to x86 (Project Properties->Build-> Platform Target)

    Option Two: Install and use 64 bit ODAC (Oracle Data Access) from here. And Compile your project with Any CPU option of platform Target. But you need to make sure that, if your project is going to run on a 32 bit computer – you need to install 32 bit of ODAC on that system. To understand more on .NET Platform Target refer this.

    Option Three: I am not sure your project type is of Web Application or a windows application. If it is a web application you can control this at IIS itself my setting the associated application pool of your web site to run on 32 bit mode. i.e ApplicationPool->Enable 32-bit mode=true.


    Lingaraj Mishra

    • Marked as answer by InformationBlackHole Wednesday, December 26, 2012 1:46 PM
    • Unmarked as answer by InformationBlackHole Wednesday, December 26, 2012 3:03 PM
    • Proposed as answer by Mike Feng Thursday, December 27, 2012 2:13 AM
    • Marked as answer by Mike Feng Tuesday, January 8, 2013 6:10 AM
    Wednesday, December 26, 2012 8:28 AM
  • Hi Allah,

    Welcome to the MSDN Forum.

    I see you have unmarked Lingaraj's solution after you marked it, would you like to tell what happened to the solution, it doesn't work on your side?

    Thank you.

    Best regards,


    Mike Feng
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, January 2, 2013 2:11 AM