开发者

Connect to Oracle in remote server with .NET

HI, In开发者_如何学Python Visual Studio 2010 I select Add new connection and then I chose Oracle server. Then I choose Oracle provider for .Net. And this window comes.

Connect to Oracle in remote server with .NET

I wonder what I should write in the Data Source text field if I the Oracle database is at server with name AZSSRV and IP address 172.117.17.1 ? Any help will be appreciated


After getting inspired with @Harrison's answer I finally was able to create a successful connection with Oracle Database located in a remote server. So I did exactly the way Harrison told me -created an environment variable named TNS_ADMIN and gave it the path where the TNSNAMES.ORA file is located(in my case it is :C:\app\Mikola\product\11.2.0\client_1\Network\Admin\Sample).But this on it own was not enough. I had to add some parameters to the file by opening it in a simple Text editor like Notepad.Here I'm posting the inner look of the TNSNAMES.ORA file:

OracleServerHost =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 172.117.17.1)(PORT = 1521))
    (CONNECT_DATA =(SID = ORCL)
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl)
    )
  )

After saving and restaring VS 2010 I got "OracleServerHost" in the Data Source name drop down list.

P.S. Modifying the TNSNAMES.ORA file might not be necessary if you had already configured the file during the installation of Oracle Client.


Your entries from TNSNames.ora should appear here and you would select the one that you need to use.

Since the drop down does not seem to be working, it would indicate that VS2010 cannot find your Oracle home.

An easy solution to this is to create an environmental variable called

TNS_ADMIN

and place the path to the TNSNames.ora file you wish to you as such

C:\app\MyDir\product\11.2.0\client_1\Network\Admin\

Close VS2010. Make the environment variable changes, then reopen, the drop down should then show you the available ora connections you may want to use.

(you can look @ this thread for a bit more info: http://forums.oracle.com/forums/thread.jspa?threadID=2213359&tstart=0)

hth

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜