Welcome Guest, Not a member yet? Register   Sign In
Problem using two different database
#1

Hello, people of the forum.
All right?

I'm working with two databases, MySQL as primary and Progress as secondary bank via ODBC ...
The following is the code for the connections:

database.php

PHP Code:
$active_group 'default';
$query_builder TRUE;
$active_record TRUE;

$db['default'] = array(
    
'dsn'    => '',
    
'hostname' => 'Xxxx',
    
'username' => 'Xxxx',
    
'password' => 'Xxxx!',
    
'database' => 'Xxxx',
    
'dbdriver' => 'mysqli',
    
'dbprefix' => '',
    
'pconnect' => FALSE,
    
'db_debug' => (ENVIRONMENT !== 'production'),
    
'cache_on' => FALSE,
    
'cachedir' => '',
    
'char_set' => 'utf8',
    
'dbcollat' => 'utf8_general_ci',
    
'swap_pre' => '',
    
'encrypt' => FALSE,
    
'compress' => FALSE,
    
'stricton' => FALSE,
    
'failover' => array(),
    
'save_queries' => TRUE
);


$db['Zzzzzzzzz'] = array(
    
'dsn'       => '',
    
'hostname' => 'Zzzz',
    
'username' => 'Zzzz',
    
'password' => 'Zzzz',
    
'database' => 'Zzzz',
    
'dbdriver' => 'odbc',
    
'dbprefix' => '',
    
'pconnect' => FALSE,
    
'db_debug' => (ENVIRONMENT !== 'production'),
    
'cache_on' => FALSE,
    
'cachedir' => '',
    
'char_set' => 'utf8',
    
'dbcollat' => 'utf8_general_ci',
    
'swap_pre' => '',
    
'encrypt' => FALSE,
    
'compress' => FALSE,
    
'stricton' => FALSE,
    
'failover' => array(),
    
'save_queries' => TRUE
); 


The default database is working normally, but when I try to access the database via ODBC with activerecord the following error:
Code:
Fatal error: Call to undefined method CI_DB_odbc_driver::get() in C:\xampp\htdocs\novo\application\modules\test\models\Md_test.php on line 15

md_test .php
PHP Code:
class Md_test extends CI_Model {

    function 
__construct(){
        
parent::__construct();
        
$this->test$this->load->database('Zzzzzzzzz'TRUE);
    }

 
   
    function buscaPedidos
($dt)
    {
        return 
$this->test->get('Zzzzz'); // line 15
    
}
 
   


Can anybody help me?
Reply


Messages In This Thread
Problem using two different database - by villa.eduardobarros - 06-11-2018, 09:29 AM



Theme © iAndrew 2016 - Forum software by © MyBB