请帮忙!我无法将 codeigniter 连接到 Oracle 我正在尝试将 Codeigniter 连接到 Oracle 11g,这是我的设置
Settings in database.php:
$active_group = 'default';
$active_record = TRUE;
$db['default']['hostname'] = "//localhost/";
$db['default']['username'] = 'xxxxxxx';
$db['default']['password'] = 'xxxxxxx';
$db['default']['database'] = 'orcl';
$db['default']['dbdriver'] = 'oci8';
$db['default']['dbprefix'] = '';
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = '';
$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_general_ci';
$db['default']['swap_pre'] = '';
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;
注意:我将 C:\instantclient_11_2 添加到环境变量到 PATH。
oracle port number:
oracle hostname: Home-pc
database name: orcl
只有当我运行我的 CodeIgniter 登录代码时,它才会显示此错误消息:
A Database Error Occurred
Unable to connect to your database server using the provided settings.
Filename: D:\xampp\htdocs\ci\system\database\DB_driver.php
Line Number: 124
但是当我运行一个简单的 php 代码时,我可以连接到 Oracle:
<?php
$conn = oci_connect("xxxxxx", "xxxxxx","");
if (!$conn) {
echo "Not connected!";
}
else
echo "yahooooooooo!!!!!!!!!!";
?>
结果:哇哇哇哇!!!!!!!!!