請幫忙!我可笨無法連接到Oracle 我試圖笨連接到Oracle 11g中,這裏是我的設置將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環境變量設置路徑。
oracle port number:
oracle hostname: Home-pc
database name: orcl
只有當我跑我的笨登錄代碼它顯示此錯誤消息:
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
但我可以連接到Oracle,當我運行一個簡單的PHP代碼,如:
<?php
$conn = oci_connect("xxxxxx", "xxxxxx","");
if (!$conn) {
echo "Not connected!";
}
else
echo "yahooooooooo!!!!!!!!!!";
?>
結果: yahooooooooo !!!!!!!!!!
你試過留下主機名,就像'localhost'一樣。沒有斜槓? – dakdad