使用.NET连接到远程服务器中的Oracle
在 Visual Studio 2010 中,我选择“添加新连接”,然后选择“Oracle 服务器”。然后我选择 Oracle .Net 提供程序,然后出现此窗口。
我想知道如果 Oracle 数据库位于具有名称的服务器上,我应该在“数据源”文本字段中写入什么内容AZSSRV 和 IP 地址 172.117.17.1?任何帮助将不胜感激。
In Visual Studio 2010 I select Add new connection and then I choose Oracle server. Then I choose Oracle provider for .Net, and this window comes.
I wonder what I should write in the Data Source text field if the Oracle database is at a server with name AZSSRV and IP address 172.117.17.1? Any help will be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在受到 @Harrison 的回答的启发后,我终于能够与位于远程服务器中的 Oracle 数据库创建成功的连接。所以我完全按照哈里森告诉我的方式做了 - 创建一个名为 TNS_ADMIN 的环境变量,并给它 TNSNAMES.ORA 文件所在的路径(在我的例子中是:C:\app\Mikola\product\11.2.0\client_1 \Network\Admin\Sample)。但这本身还不够。我必须通过在简单的文本编辑器(如记事本)中打开文件来向该文件添加一些参数。这里我发布了 TNSNAMES.ORA 文件的内部外观:
保存并重新启动 VS 2010 后,我在数据源中得到了“OracleServerHost”名称下拉列表。
PS 如果您在安装 Oracle 客户端期间已经配置了 TNSNAMES.ORA 文件,则可能不需要修改该文件。
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:
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.
您在 TNSNames.ora 中的条目应该出现在此处,您可以选择需要使用的条目。
由于下拉菜单似乎不起作用,这表明 VS2010 无法找到您的 Oracle 主目录。
一个简单的解决方案是创建一个名为的环境变量
并放置您想要的 TNSNames.ora 文件的路径
像这样
关闭 VS2010。更改环境变量,然后重新打开,下拉列表应显示您可能想要使用的可用 ora 连接。
(您可以查看@此线程以获取更多信息:http: //forums.oracle.com/forums/thread.jspa?threadID=2213359&tstart=0)
hth
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
and place the path to the TNSNames.ora file you wish to you
as such
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