Oracle 数据访问组件和 Visual Studio 连接问题

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5697746/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 23:22:26  来源:igfitidea点击:

Oracle Data Access Components and Visual Studio connection problems

oraclevisual-studio-2010

提问by JHarnach

I've created an empty console application in Visual Studio 2010 and I'm attempting to add an Oracle (10g XE ) Data Connection via the Server Explorer. I'm using Oracle ODP .NET as the connector and I get the following error:

我在 Visual Studio 2010 中创建了一个空的控制台应用程序,我正在尝试通过服务器资源管理器添加一个 Oracle (10g XE) 数据连接。我使用 Oracle ODP .NET 作为连接器,但出现以下错误:

ORA-12560: TNS: Protocol Adapter Error

ORA-12560: TNS: 协议适配器错误

I can access Oracle without issue via the web interface or a console, but continually get this generic connection error in VS. I'm using the default installation of Oracle XE and running it locally.

我可以通过 Web 界面或控制台毫无问题地访问 Oracle,但在 VS 中不断出现此通用连接错误。我正在使用 Oracle XE 的默认安装并在本地运行它。

Any suggestion on how to get this set up correctly ? Every tutorial I find works on the understanding that this connection succeeds. As such I'm struggling to find where to begin to troubleshoot. I'm comfortable with VS2010, but new to the way Oracle does things with their DB.

关于如何正确设置此设置的任何建议?我发现的每个教程都基于这种连接成功的理解。因此,我正在努力寻找从哪里开始进行故障排除。我对 VS2010 很满意,但对 Oracle 处理数据库的方式不熟悉。

EDIT 1While troubleshooting I've found this only happens with the Oracle Data Provider for .NET. Using the .NET Framework Data Provider for Oracle I am able to successfully connect.

编辑 1在进行故障排除时,我发现这只发生在 Oracle Data Provider for .NET 上。使用 .NET Framework Data Provider for Oracle 我能够成功连接。

EDIT 2I cleaned up everything and installed 11g XE and the ODAC tools again and continue to get the same message. I realize the error is somewhat generic, I'd be happy to post more information if anyone thinks it helpful. The database is run locally, I can't imagine what kind of 'configuration' an express database would even need...

编辑 2我清理了所有内容并再次安装了 11g XE 和 ODAC 工具,并继续收到相同的消息。我意识到这个错误有点笼统,如果有人认为它有帮助,我很乐意发布更多信息。数据库在本地运行,我无法想象快速数据库甚至需要什么样的“配置”......

EDIT 3The ODAC tools appear to install a 'production' version of Oracle 11 instead of the BETA version that I installed first. Almost appears as if the tool is installing another database ? I also appear to have two ORACLE_BASE locations and two TNSNAMES in what appear to be very similar folder hierarchies. Perhaps a more straightforward tutorial is the answer, Oracle's isn't very descriptive.

编辑 3ODAC 工具似乎安装了 Oracle 11 的“生产”版本,而不是我首先安装的 BETA 版本。几乎看起来好像该工具正在安装另一个数据库?我似乎也有两个 ORACLE_BASE 位置和两个 TNSNAMES,它们在看起来非常相似的文件夹层次结构中。也许更直接的教程是答案,Oracle 的描述性并不强。

采纳答案by JHarnach

Oracle 10g XE seemed to be the problem. A full install of 11g (Full, not Express) took care of the problem entirely.

Oracle 10g XE 似乎是问题所在。完全安装 11g(Full,不是 Express)完全解决了这个问题。

回答by granadaCoder

Wow. I finally got this syntax to work. I'm a Sql Server guy. I used Oracle back in the da day. But I'm trying to do some Entity Framework and I said "You're not going to bed until you get Visual Studio 2012 and a edmx file to talk to Oracle.

哇。我终于让这个语法起作用了。我是一个 Sql Server 的人。我在过去使用 Oracle。但我正在尝试做一些实体框架,我说“在你获得 Visual Studio 2012 和一个 edmx 文件与 Oracle 交谈之前,你不会睡觉。

Geeze.

天啊。

Here is what I came up with:

这是我想出的:

Data Source: Oracle Database (Oracle ODP.NET)

数据来源:Oracle 数据库 (Oracle ODP.NET)

Data Source Name: localhost:1521/orcl

数据源名称:localhost:1521/orcl

User Name: SYSTEM

用户名:系统

回答by Zubaer Naseem

change the default data source name to localhost.

将默认数据源名称更改为 localhost。

回答by Mitch Wheat

From here:

这里

Possible fixes for the TNS-12560 include:

  1. Get the latest patches for the SQL*Net client software.

  2. Check your $ORACLE_HOME and $Path variables.

  3. Check File permissions on the PC client.

  4. Ensure that TNS_ADMIN is set correctly.

  5. Check for firewall issues.

  6. Check that the Windows database service is started. Verify teh ORACLE_SID parameter is set correctly in the registry.

TNS-12560 的可能修复包括:

  1. 获取 SQL*Net 客户端软件的最新补丁。

  2. 检查您的 $ORACLE_HOME 和 $Path 变量。

  3. 检查 PC 客户端上的文件权限。

  4. 确保 TNS_ADMIN 设置正确。

  5. 检查防火墙问题。

  6. 检查 Windows 数据库服务是否已启动。验证在注册表中正确设置了 ORACLE_SID 参数。