Warning: oci_connect() [function.oci-connect]: ORA-12154: TNS:could not resolve the connect identifier specified in /www/petdog/htdocs/oracle_test.php on line 3
ORA-12154: TNS:could not resolve the connect identifier specified用网上的一段简单连接代码,在winxp下可以实现,在linux下就出现上述情况,怎么个问题?
大侠们,求解答。

解决方案 »

  1.   

    其实大多数情况下,我都来者给分的,哈哈。连接问题,搜索了一下,我猜可能的问题在:oracle_sid,
    phpinfo()显示两个参数,一个有oracle_home,另一个有sid,但是我没有这个oracle_sid据说这是分清oracle连接的实例 ,那么我怎么建立这个参数。求大侠指教。
      

  2.   

    $conn = oci_connect('dw', 'dw', 'dw');
    if (!$conn) {
      $e = oci_error();
      print htmlentities($e['message']);
      exit;
    }$query = 'SELECT * FROM CHINA';$stid = oci_parse($conn, $query);
    if (!$stid) {
      $e = oci_error($conn);
      print htmlentities($e['message']);
      exit;
    }$r = oci_execute($stid, OCI_DEFAULT);
    if(!$r) {
      $e = oci_error($stid);
      echo htmlentities($e['message']);
      exit;
    }print '<table border="1">';
    while($row = oci_fetch_array($stid, OCI_RETURN_NULLS)) {
      print '<tr>';
         foreach($row as $item) {
           print '<td>'.($item?htmlentities($item):' ').'</td>';
         }
         print '</tr>';
    }
    print '</table>';oci_close($conn);这是一段连接oracle的代码,数据库是远程的,比如数据库内网ip是10.10.300.10,但是用这个oci_connect怎么把这个 ip host写进去。可以在win系统中运行,但在linux 下报错。
    我猜想是不是这个原因,它在linux下默认找不到host这个地址,还是linux缺少客户端的连接等。这个项目里已经有一个adodb连接数据库了,所以是不是这个新链接找不到呢。或者要标志呢,看有什么oracle_sid之类的,不懂,求教 大侠