解决方案 »

  1.   

    需要安装 oracle11g 的客户端因为自 oracle 9 起,他的客户端就单独发行了,php 已经没有必要将客户端捆绑进来
    所以只提供了与客户端通讯的接口 php_oci8 和 php_oci8_11g
    由于 oracle11g 的客户端做了很大的改动,因此才有 php_oci8_11g 与之连接,主要是为了使用 oracle 的新功能
      

  2.   

     谢谢这位大神,本人小白,基本是按着这篇文章安装的64位oracle
    http://blog.sina.com.cn/s/blog_868ba3570101djuh.html
    搞了32位的客户端,但是他提到的 tnsnames.ora 这个文件我在%Oracle_Home%\NETWORK\ADMIN下面没有找到。请问然后我该怎么办呢?
      

  3.   

    你看看这个 http://download.csdn.net/download/eisjmo/4362471
      

  4.   

    很长时间没有弄了,细节都记不清了
    不过映像中只要 setup 就可以了,没有什么需要配置的
      

  5.   

    现在有了新情况,我简单测试下连接数据库,报 Warning: oci_connect(): ORA-12154: TNS:could not resolve the connect identifier specified in C:\xampp\htdocs\phpwork1\test.php on line 17
    ORA-12154: TNS:could not resolve the connect identifier specified
    环境变量也配了,不好使
      

  6.   

    <?php $conn = oci_connect('system', '123456', 'aaa');
    if (!$conn) {
    $e = oci_error();
    print htmlentities($e['message']);
    exit;
    }$query = 'SELECT * FROM DEPARTMENTS';//编译SQL语句:函数:oci_parse()
    $stid = oci_parse($conn, $query);
    if (!$stid) {
    $e = oci_error($conn);
    print htmlentities($e['message']);
    exit;
    }//执行SQL语句:函数:oci_execute();
    $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):'&nbsp;').'</td>';
    }
    print '</tr>';
    }
    print '</table>';oci_close($conn);?>
    就是php手册里的一段
      

  7.   

    谢谢大神,我用pdo返回差不多的信息
     SQLSTATE[42S02]: pdo_oci_handle_factory: ORA-12154: TNS:could not resolve the connect identifier specified (ext\pdo_oci\oci_driver.c:633) 
    代码 
    $tns="aaa";
    try{
    $conn=new PDO("oci:dbname=".$tns, 'system', '123456');
    }catch(PDOException $e){
    echo ($e->getMessage());
    }
    此外为何我PDO_OCI下毛也没有呢 php.ini里已经启动了extension=php_pdo_oci.dll
      

  8.   

    $db = new PDO('oci:dbname=//机器名或ip:1521/实例名', '用户名', '口令');
    $rs = $db->query('sql指令' );