sxlnok
(Sxlnok)
November 5, 2009, 4:33am
1
PDO
PDO support enabled
PDO drivers mysql, oci, sqlite 已开启
oci8
OCI8 Support enabled
Version 1.2.5
Revision $Revision: 1.269.2.16.2.44 $
Active Persistent Connections 0
Active Connections 0
Temporary Lob support enabled
Collections support enabled 已开启
测试:
$dbh = new PDO(‘oci:dbname=//192.168.1.118:1521/XE’, ‘Center’, ‘simon’);
可以连接 可以查询
yii db 配置
‘connectionString’=>‘oci:dbname=//192.168.1.118:1521/XE’,
‘username’=>‘Center’,
‘password’=>‘simon’,
创建 model user
提示
exception ‘CDbException’ with message 'CDbConnection failed to open the DB conne
ction: could not find driver’ in E:\wamp\www\yii7\framework\db\CDbConnection.php
:248
php日志提示
[05-Nov-2009 11:46:53] PHP Warning: PHP Startup: Invalid library (maybe not a PHP library) ‘php_pdo_oci8.dll’ in Unknown on line 0
请各位帮忙?oracle服务器是10G
ragkk
(Ragkk)
November 5, 2009, 5:24am
2
我记得oracle 8i 客户端是不能够连接oracle 10g的。
如果你使用的是oracle 10g 的数据库的话,最好用oracle 10g的客户端。PHP库用PHP_pdo_oci.dll
用oci代替oci8。用法一样
dennis
(Dennislanjt)
September 29, 2010, 3:46am
3
应该是 Yii 的 driver 写的有问题。 我试过各种方法。 都无法连结到 Oracle.
CDbConnection failed to open the DB connection: SQLSTATE[HY000]: pdo_oci_handle_factory: ORA-12504: TNS:listener was not given the SERVICE_NAME in CONNECT_DATA
(ext\pdo_oci\oci_driver.c:579)
连 mysql 没问题。 Oracle 的肯定测试不够。
建议产品环境使用 ADODB, 这个毕竟是久经考验的。
dennis
(Dennislanjt)
September 29, 2010, 5:32am
4
测试 n 久, 这个问题终于解决 在 main.php 中
改成如下:
也就是把
‘charset’=>‘utf8’ 拿掉, 就好了.
‘db’=>array(
'connectionString' => 'oci:dbname=192.168.0.250:1521/test',
'emulatePrepare' => true,
'username' => 'xxxx',
'password' => 'xxxx'
),