I am able to connect to a User DSN on my linux box (using ODBC).
How do I get to connect using code igniter?
in my database.php I have the default database:
$active_group = 'default';
$active_record = TRUE;
$db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'user';
$db['default']['password'] = 'pass';
$db['default']['database'] = 'db_main';
$db['default']['dbdriver'] = 'mysql';
$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;
however I also need to simultaneously connect to another database using ODBC:
So I have in my controller:
public function index()
{
$dsn = 'NZSQL://someuser:password@host/somedatabase';
$this->load->database($dsn);
$this->db->query("SELECT * FROM Cust Limit 10");
$result = $this->db->result();
}
I get the error:
A Database Error Occurred
Error Number: 1146
Table 'db_main.Cust' doesn't exist
SELECT * FROM Cust Limit 10
Filename: /var/www/controllers/netezzatest.php
Line Number: 28