当前位置:Gxlcms >
数据库问题 >
C#通过Oracle.ManagedDataAccess无法访问Oralce
C#通过Oracle.ManagedDataAccess无法访问Oralce
时间:2021-07-01 10:21:17
帮助过:18人阅读
void Main(
string[] args)
{
string connStr=
string.Empty;
try
{
connStr =
string.Format(
@"User Id={3};Password={4}; Data Source=(description=(address_list = (address = (HOST = {0})(PROTOCOL = TCP)(PORT= {1})))(connect_data=(service_name={2})));",
"172.23.11.152",
"1521",
"orcl",
"system",
"oracle123");
using (OracleConnection conn =
new OracleConnection(connStr))
{
OracleCommand comm =
new OracleCommand(
"select count(1) from wifi.site_info", conn);
conn.Open();
object a =
comm.ExecuteScalar();
conn.Close();
Console.WriteLine(a);
}
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
Console.WriteLine("连接字符串:" +
connStr);
}
Console.Read();
}
View Code
解决:
经过多方面查找资料,最后在一篇英文网站上面提到是FIPS加密的原因导致,至于如何解决,网上给到的答案大多就是将FIPS关闭了。关闭方法如下:
1.输入regedit打开系统注册表
2.找到路径 HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Lsa
3.查看右边的FIPSAlgorithmPolicy属性修改为0
4.找到路径 HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Lsa\FipsAlgorithmPolicy\
5.查看右边的Enabled修改为0 即可。
C#通过Oracle.ManagedDataAccess无法访问Oralce
标签:英文 acl hid cti log controls closed prot aac