1

How can I connect to my Oracle 11g release 11.2.0.1.0 ?

My .Net framework is 4. my OS is windows 7 64 bit version.

I read some sample from Google and tested but it's not working.

This is my code. I used VS2012 Express 2012 for Web.

I used Oracle.DataAccess.. Any sample codes or instruction help is appreciated..

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using Oracle.DataAccess.Client;

    namespace WebApplication1
    {
        public partial class index : System.Web.UI.Page
        {
            protected void Page_Load(object sender, EventArgs e)
            {
                OracleConnection connection = new OracleConnection("Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=myhost)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=mySid)));User Id=xxx;Password=xxx;");
                try
                {
                    connection.Open();
                }
                catch (Exception exp)
                {
                    Console.WriteLine(exp.Message);
                }
            }
        }

} 

This is my error..

Server Error in '/' Application.

The provider is not compatible with the version of Oracle client

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: Oracle.DataAccess.Client.OracleException: The provider is not compatible with the version of Oracle client

Source Error: 


Line 13:         protected void Page_Load(object sender, EventArgs e)
Line 14:         {
Line 15:             OracleConnection connection = new OracleConnection("Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=xxxx)(PORT=xxxx)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=xxx)));User Id=xxx;Password=xxxx;");
Line 16:             try
Line 17:             {

Source File: c:\PLanguages\PSources\C#\WebApplication1\WebApplication1\index.aspx.cs    Line: 15 

Stack Trace: 


[OracleException (0x80004005): The provider is not compatible with the version of Oracle client]
   Oracle.DataAccess.Client.OracleInit.Initialize() +624
   Oracle.DataAccess.Client.OracleConnection..cctor() +903

[TypeInitializationException: The type initializer for 'Oracle.DataAccess.Client.OracleConnection' threw an exception.]
   Oracle.DataAccess.Client.OracleConnection..ctor(String connectionString) +0
   WebApplication1.index.Page_Load(Object sender, EventArgs e) in c:\PLanguages\PSources\C#\WebApplication1\WebApplication1\index.aspx.cs:15
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +51
   System.Web.UI.Control.OnLoad(EventArgs e) +92
   System.Web.UI.Control.LoadRecursive() +54
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +772

4 Answers 4

2

I found an answer in here.

I just need to overwrite my environment variables and I can connect easily.

Sign up to request clarification or add additional context in comments.

1 Comment

We can't find the page you were looking for.
0

Use the oracle odp.net to connect to oracle database and you will be ok.

Comments

0

my suggestion is to install the package odp.net.x64., you have to do is go to tools., Libery package manager., Package manager console and enter the following Install-Package odp.net.x64

Comments

-1

The below link solved my problem.

https://www.codeproject.com/Questions/617272/The-provider-is-not-compatible-with-the-version-of

1) Check if you are compiling to x86 or Any CPU (Any CPU is preferred since it will work on 64bit and 32bit and possibly your asmx is 64bit which is working).

2) Check your .net versions you are building with in your projects.

1 Comment

Link only answer is not encouraged, share the context from the link here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.