2013-06-10 2 views
1

Oracle 11g release 11.2.0.1.0에 어떻게 연결할 수 있습니까?ASP.NET에서 Oracle 11g를 연결하십시오.

.Net framework is 4. 내 OS는 windows 7 64 bit 버전입니다.

Google에서 일부 샘플을 읽고 테스트했지만 작동하지 않습니다.

이것은 내 코드입니다. 나는 VS2012 Express 2012 for Web을 사용했습니다. 오라클 odp.net는 오라클 데이터베이스에 연결하는

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 

답변

2

here에 대한 답변을 찾았습니다.

환경 변수를 덮어 쓰면 쉽게 연결할 수 있습니다.

0

사용이 내 오류가

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); 
       } 
      } 
     } 

} 

내가 모든 샘플 코드 또는 명령의 도움에 감사드립니다 .. Oracle.DataAccess를 사용

... .. 너 괜찮을거야.

0

제 제안은 odp.net.x64 패키지를 설치하는 것입니다. 도구, Libery 패키지 관리자, 패키지 관리자 콘솔에 다음을 입력하십시오. 설치 패키지 odp.net.x64

-1

아래 링크는 내 문제를 해결했습니다.

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

1) 당신이 64 비트 및 32 비트 그리고 아마도 당신의 ASMX에서 작동하기 때문에 어떤 CPU가 바람직하다 (x86 또는 모든 CPU에 컴파일되어 있는지 확인은 64 비트 노력 )입니다.

2) 프로젝트에서 빌드중인 .net 버전을 확인하십시오.

+0

링크 만 대답하는 것은 좋지 않으므로 여기 링크에서 문맥을 공유하십시오. –

+0

이 링크는 질문에 대답 할 수 있지만 답변의 핵심 부분을 여기에 포함시키고 참조 용 링크를 제공하는 것이 좋습니다. 링크 된 페이지가 변경되면 링크 전용 답변이 유효하지 않게 될 수 있습니다. - [From Review] (리뷰/저품절 게시물/18054820) –

관련 문제