Oracle C# 连接无法识别的错误
Oracle C# Connection Unidentifiable error
我是 C# 的新手,正在尝试通过一段简单的代码连接到 Oracle 数据库。我遇到了很多连接错误,并尝试通过 Google 搜索解决它们并解决了它们。
我现在在 conn.Open();
语句中遇到错误:
An unhandled exception of type 'Oracle.DataAccess.Client.OracleException' occurred in Oracle.DataAccess.dll
Additional information: External component has thrown an exception.
我不知道这个错误是什么意思。我尝试并搜索了很多,但找不到任何东西。
代码:
string connection_string = "Data Source=localhost;Persist Security Info=True;User ID=system;Password=6677";
OracleConnection conn = new OracleConnection(connection_string);
conn.Open();
我还尝试了许多其他 connection_string
包括
Data Source=(DESCRIPTION =" + "(ADDRESS = (PROTOCOL = TCP)(HOST =localhost)(PORT = 1521))" + "(CONNECT_DATA =" + "(SERVER = DEDICATED)" + "(SERVICE_NAME = XE)));" + "User Id=system;Password=6677;"
没有任何效果。
这可以是很多不同的东西。
- 尝试换一个用户 “system”是一个内部用户并且有 SYSDBA 权限。您可以尝试添加新用户吗:
CREATE USER test IDENTIFIED BY test;
并使用此连接字符串连接:
"SERVER=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=XE)));uid=test;pwd=test;"
(你可以看看here不同的连接字符串)
- 仔细检查您的客户端安装。在环境变量的屏幕截图中,您似乎安装了 2 个客户端:32 位和 64 位。如果您在项目中使用 64 位 DLL,请删除 32 位环境变量。
根据你的 %PATH%
你真的搞砸了你的 Oracle 安装。
正确删除所有这些(参见How to uninstall / completely remove Oracle 11g (client)?) and make one fresh installation. If you need the 32-bit and 64-bit Client follow this one: BadImageFormatException. This will occur when running in 64 bit mode with the 32 bit Oracle client components installed
我是 C# 的新手,正在尝试通过一段简单的代码连接到 Oracle 数据库。我遇到了很多连接错误,并尝试通过 Google 搜索解决它们并解决了它们。
我现在在 conn.Open();
语句中遇到错误:
An unhandled exception of type 'Oracle.DataAccess.Client.OracleException' occurred in Oracle.DataAccess.dll
Additional information: External component has thrown an exception.
我不知道这个错误是什么意思。我尝试并搜索了很多,但找不到任何东西。
代码:
string connection_string = "Data Source=localhost;Persist Security Info=True;User ID=system;Password=6677";
OracleConnection conn = new OracleConnection(connection_string);
conn.Open();
我还尝试了许多其他 connection_string
包括
Data Source=(DESCRIPTION =" + "(ADDRESS = (PROTOCOL = TCP)(HOST =localhost)(PORT = 1521))" + "(CONNECT_DATA =" + "(SERVER = DEDICATED)" + "(SERVICE_NAME = XE)));" + "User Id=system;Password=6677;"
没有任何效果。
这可以是很多不同的东西。
- 尝试换一个用户 “system”是一个内部用户并且有 SYSDBA 权限。您可以尝试添加新用户吗:
CREATE USER test IDENTIFIED BY test;
并使用此连接字符串连接:
"SERVER=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=XE)));uid=test;pwd=test;"
(你可以看看here不同的连接字符串)
- 仔细检查您的客户端安装。在环境变量的屏幕截图中,您似乎安装了 2 个客户端:32 位和 64 位。如果您在项目中使用 64 位 DLL,请删除 32 位环境变量。
根据你的 %PATH%
你真的搞砸了你的 Oracle 安装。
正确删除所有这些(参见How to uninstall / completely remove Oracle 11g (client)?) and make one fresh installation. If you need the 32-bit and 64-bit Client follow this one: BadImageFormatException. This will occur when running in 64 bit mode with the 32 bit Oracle client components installed