安装ODAC for Entity Framework后连接数据库TNS: could not resolve the connect identifier specified

  安装ODAC for Entity Framework后,连接数据库报错Oracle 10g ORA-12154:TNS: could not resolve the connect identifier specified 解决方法:

     1.右键我的电脑-属性-高级-环境变量 ,在系统变量中选中 path 点击编辑,查看变量值发现是D:\app\Administrator\product\11.2.0\client_2;D:\app\Administrator\product\11.2.0\client_2\bin;D:\app\Administrator\product\11.2.0\client_1\bin; 是安装ODAC后生成的client_2吗?高手请留言。

     2.看看client_2文件夹中是什么情况吧,D:\app\Administrator\product\11.2.0\client_2\Network\Admin\Sample中的tnsnames.ora空空如也,将复制Sample里面的两个文件复制出来,然后把client_1中的tnsnames.ora内容贴到client_2的tnsnames.ora中,就可以了。

     3.使用PL/SQL Developer提示:NLS_LANG is not defined on the client.Character set conversion may cause unexpected results.

  解决方法:
  修改注册表,在运行中输入regedit ,找到ORACLE\KEY_OraClient11g_homexx,右键新建“字符串值(S)”项为“NLS_LANG”,值为“SIMPLIFIED CHINESE_CHINA.ZHS16GBK”。

  若在64位的环境下安装32为的程序,则修改注册表路径为HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\ORACLE\KEY_OraClient11g_home2,新建“字符串值(S)”项为“NLS_LANG”,值为“SIMPLIFIED CHINESE_CHINA.ZHS16GBK”

原文地址:https://www.cnblogs.com/beautifulplanet/p/2607814.html