c#链接oracle数据库报错 The provider is not compatible with the version of Oracle client

fffanpei 2016-08-19 09:20:37
请教各位一个问题。拿到别人的一个程序,链接数据库现在问题描述如下。

1. 安装oracle 12c 64位客户端。
用oracle sql dev 和 pl/sql工具可以连接成功数据库。

2. 用Oracle.DataAccess.Client下面方法链接数据库的。
其中_oraConn 为 Data Source=prj-meamut-ora1;User ID=username;Password=password;

private OracleConnection GetOracleConnection()
{
try
{
string oraDB = ConfigHelper.GetEncConnectionString(Constants.CONN_KEY);
OracleConnection _oraConn = new OracleConnection(oraDB);
return _oraConn;
}
catch (Exception ex)
{
throw new Exception("Error getting Oracle connection", ex);
}
}

3.现在调试链接时候报错。
The provider is not compatible with the version of Oracle client

请问是我的client安装版本有问题吗 还是怎样?
谢谢大家
...全文
459 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
fffanpei 2016-08-19
  • 打赏
  • 举报
回复
引用 1 楼 bdmh 的回复:
版本不匹配,项目中使用的dll和oracle版本不一致
您的意思 我加入client对应的这个dll的路径进行编译吗? 我试了一下 加入这个Oracle.DataAccess(E:\app\client\pfan\product\12.1.0\client_1\ODP.NET\bin\2.x\Oracle.DataAccess.dll) 现在 会变成Could not load file or assembly 'Oracle.DataAccess, Version=2.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342' or one of its dependencies. An attempt was made to load a program with an incorrect format. 错误 而且数据库链接部分无法进行debug了
  • 打赏
  • 举报
回复
引用 1 楼 bdmh 的回复:
版本不匹配,项目中使用的dll和oracle版本不一致
+1
bdmh 2016-08-19
  • 打赏
  • 举报
回复
版本不匹配,项目中使用的dll和oracle版本不一致
fffanpei 2016-08-19
  • 打赏
  • 举报
回复
顶起来 谢谢大家

110,539

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧