我想連接oracle 11g與codeigniter(V-2.1.4)使用xampp(v-1.7.3)。我已經改變了我的config.php這樣:連接oracle 11g與codeigniter
$active_group = 'default';
$active_record = TRUE;
$db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'system';
$db['default']['password'] = 'root';
$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;
和DB_driver.php文件也改變var $dbdriver = 'oci8';
。 但他不能連接數據庫。我得到某種數據庫錯誤。它說:
Unable to connect to your database server using the provided settings.
Filename: G:\F\installed\Xampp\xampp\htdocs\codeigniter\system\database\DB_driver.php
Line Number: 124
我給線118 - 127 DB_driver.php這裏:
if (! $this->conn_id)
{
log_message('error', 'Unable to connect to the database');
if ($this->db_debug)
{
$this->display_error('db_unable_to_connect'); (this is line 124)
}
return FALSE;
}
我想補充一點,當我嘗試用下面的代碼,我能夠看到「連接與Oracle DB成功連接:-)「此消息。
conn=oci_connect("system","root","localhost/orcl");
If (!$conn)
echo "Failed to connect to Oracle";
else
echo "Succesfully connected with Oracle DB :-)";