我正在尝试从 C# 连接 Oracle 11g。我已关注[此链接],定义了连接别名,如下所示:
moviess =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = xe)
)
)
When trying to connect using server explorer in Visual studio it gives me the following error :
Here is the installation directory of the Oracle Developer Tool for Visual Studio.
我哪里出错了?请帮助我。
这就是问题:
ORA-12154: TNS: Could not resolve the connect identifier specified
原因是这样的:
https://docs.oracle.com/cd/B19306_01/server.102/b14219/net12150.htm https://docs.oracle.com/cd/B19306_01/server.102/b14219/net12150.htm
ORA-12154: TNS: 无法解析指定的连接标识符
原因:使用连接标识符请求与数据库或其他服务的连接,并且指定的连接标识符可能
不能使用以下命名之一解析为连接描述符
配置的方法。
例如,如果连接标识符的类型
使用的是网络服务名称,则不能使用网络服务名称
在命名方法存储库中找到,或者存储库无法
位于或到达。
Action:
- If you are using local naming (TNSNAMES.ORA file):
- Make sure that "TNSNAMES" is listed as one of the values of the NAMES.DIRECTORY_PATH parameter in the Oracle Net profile (SQLNET.ORA)
- Verify that a TNSNAMES.ORA file exists and is in the proper directory and is accessible.
- Check that the net service name used as the connect identifier exists in the TNSNAMES.ORA file.
问:您的本地 PC 上是否实际安装了 Oracle 11g?如果没有,则不能使用“localhost”。您还必须安装 Oracle 客户端。
相关链接:
通过C#连接Oracle数据库? https://stackoverflow.com/questions/12568100/connecting-to-oracle-database-through-c
Oracle Data Provider for .Net 入门 http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/hol08/dotnet/getstarted-c/getstarted_c_otn.htm
使用 ADO.Net 连接到 Oracle 数据源 https://docs.oracle.com/cd/B28359_01/win.111/b28375/featConnecting.htm
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)