2

Im using a .net OracleClient in my machine for connecting to a Database in Oracle. When im trying to connect its showing this TNS Error.

Now, I have edited the tnsnames.ora file and sqlnet.ora file. When I access the Oracle using a ServerExplorer. It gets connected to the Oracle Database and its fetching everything.

I do have a ODAC component from oracle website itself which also, i tried but dint worked.

My connection string is<add name="netOracleClient" connectionString="Data Source=ff.WORLD;Persist Security Info=True;User ID=vlc;Password=vlc;Unicode=True" providerName="System.Data.OracleClient" /> <add name="ConnectionString" connectionString="DATA SOURCE=ff.WORLD;PASSWORD=vlc;USER ID=vlc" providerName="Oracle.DataAccess.Client" />

I tried with ServerExplorer in both the components. Its working FINE with Server explorer and im getting the datas too. But when i write the code its throwing me this error ORA-12154: TNS:could not resolve the connect identifier specified

This is the code from which Im trying to connect.

 OracleConnection con = new OracleConnection(WebConfigurationManager.ConnectionStrings["netOracleClient"].ConnectionString);

Tell me a way to resolve this???

NOTE: We have machines here itself from which we are accesing the same database with the same TNS using OracleClient for .net. I also wants to use the same..

Please Help me in this.

4

3 に答える 3

1

今は私のために働いています。これを行うための手順。

  • 複数の TNSNames.ORA ファイルがあることに気付きました。
  • その後、それが Oracle Client バージョン 8.x を指していることがわかったため、正しく動作していませんでした。それで、それを扱うために...
  • すべての Oracle クライアント バージョンを削除しました (VisualStudio Oracle クライアントを新しいバージョンに向けることができなかったため)

  • 再度再インストールしました。再起動後、動作を開始しました。

于 2012-08-08T07:31:01.627 に答える
0

この接続文字列で ODAC が正常に動作しています。

<ConnectionString name="ServerConnection">Data Source=PROD;User Id=DBUSER1;Password=DBPASSWORD1;Pooling=False;</ConnectionString>

Oracle/Network/Admin フォルダーのサンプル tnsnames.ora ファイルと同じように、データ ソース - PROD を定義する tnsnames.ora と共に。

tnsnames.ora エントリは次のようになります

DDSENT3 =    
  (DESCRIPTION =        
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.15.10)(PORT = 1521))    
    (CONNECT_DATA =    
      (SERVER = DEDICATED)    
      (SERVICE_NAME = DDSENT3)    
    )
  )
于 2012-01-17T09:08:20.840 に答える
0

以下を に追加してみてくださいweb.config:

<oracle.manageddataaccess.client>
    <version number="*">
      <settings>
        <!-- Set this path if you are using TNS aliases as connection strings (not recommended) -->
        <!-- Instead you can use "SERVER_NAME:PORT/SERVICE_NAME" as your data source -->
        <setting name="TNS_ADMIN" value="C:\oracle\product\11.2.0\client_3\Network\Admin\"/>
      </settings>
...

もちろん、フォルダの場所を追加するだけです。

于 2014-12-31T09:57:51.133 に答える