I have seen and tried all the solutions in Codeigniter - multiple database connections, You have specified an invalid database connection group codeigniter error, firebird - codeigniter connection and none of them worked.
$db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'root';
$db['default']['password'] = '';
$db['default']['database'] = 'testing';
$db['default']['dbdriver'] = 'mysqli';
$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['fbird']['hostname'] = "localhost";
$db['fbird']['username'] = "SYSDBA";
$db['fbird']['password'] = "masterkey";
$db['fbird']['database'] = "C:\waitkyl.fdb";
$db['fbird']['dbdriver'] = "firebird";
After this configuration, I call the fbird
database this way:
class Fb_model extends CI_Model{
public function __construct(){
parent::__construct();
}
public function getAll(){
$db = $this->load->database('fbird', TRUE);
return $db->get('categories')->result();
}
}
And the error I get after trying output the values print_r($this->fb_model->getAll());
is:
Fatal error: Call to a member function result() on a non-object
That usually means that the table 'categories' doesn't exists..which isn't true.
So I have tried to change my configuration file into:
$db['fbird']['hostname'] = "localhost";
$db['fbird']['username'] = "SYSDBA";
$db['fbird']['password'] = "masterkey";
$db['fbird']['database'] = "C:\waitkyl.fdb";
$db['fbird']['dbdriver'] = "firebird";
$db['fbird']['dbprefix'] = "";
$db['fbird']['pconnect'] = FALSE;
$db['fbird']['db_debug'] = TRUE;
$db['fbird']['cache_on'] = FALSE;
$db['fbird']['cachedir'] = "";
$db['fbird']['char_set'] = "utf8";
$db['fbird']['dbcollat'] = "utf8_general_ci";
And also removed from the php.ini
file the ;
from the following lines:
extension=php_pdo_firebird.dll
extension=php_interbase.dll
And if I refresh the page now the error I receive is:
Unable to connect to your database server using the provided settings.
Filename: C:\xampp\htdocs\projtesting\system\database\DB_driver.php
Line Number: 124
In order to see if the credentials from the database were fine I opened it on the software SQL Manager 2008 Lite for Interbase and Firebird
, and it was ok.
Any ideas of what's going wrong?