程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 網頁編程 >> PHP編程 >> 關於PHP編程 >> PHP連接Oracle ORA-121154問題解決

PHP連接Oracle ORA-121154問題解決

編輯:關於PHP編程

 錯誤提示:ocilogon(): ORA-12154: TNS:could not resolve the connect identifier specifie!

 


操作系統:Win7

本地環境:xampp-win32-1.8.2-1-VC9 、 Oracle 10g。

PHP連接測試代碼:

 

[php]
<?php 
ocilogon('emesc','emesc','mesb'); 
//print_r(oci_error());  
?> 

<?php
ocilogon('emesc','emesc','mesb');
//print_r(oci_error());
?>結果發現提示:ocilogon(): ORA-12154: TNS:could not resolve the connect identifier specifie!

 

 

原因分析:之前通過自己配置tnsnames.ora和環境變量來使用PL/SQL,導致安裝oracle客戶端的時候環境變量異常。導致PHP無法解析連接字符串。

 


解決方案:在系統中添加:名為TNS_ADMIN的環境變量:D:\oracle\product\10.2.0\db_1\network\ADMIN。測試連接成功!

 

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved