Oracle 10g ORA-12154: TNS: could not resolve the connect identifier specified

来源:互联网 发布:网络购物如何付款 编辑:程序博客网 时间:2024/06/06 13:08

通过OCI连数据库,出错

Oracle 10g ORA-12154: TNS: could not resolve the connect identifier specified

string server="mydb"; // 网上事例都是这种只有数据库名的。我连的数据库在服务器上,所以要加上host
string server="201.68.205.56:1521/mydb";  // 正确格式。即 host:port/database


Oracle 官方文档,关于连接数据库字符串的  http://docs.oracle.com/cd/B28359_01/appdev.111/b28395/oci01int.htm#autoId39


其它原因:

环境变量    http://www.blogjava.net/wahahacj/archive/2007/11/19/161689.html