Welcome Guest, Not a member yet? Register   Sign In
CODEIGNITER 4: Multiple Database Connection (MySQL and Oracle)
#3

You should only need to change the group name property when loading a database.

PHP Code:
$db = \Config\Database::connect('group_name'false); 


Database settings.

PHP Code:
public $defaultGroup 'default';

    /**
     * The default database connection.
     *
     * @var array
     */
    public $default = [
        'DSN'      => '',
        'hostname' => 'localhost',
        'username' => 'root',
        'password' => 'PASSWORD',
        'database' => 'DATABASE',
        'DBDriver' => 'MySQLi',
        'DBPrefix' => '',
        'pConnect' => false,
        'DBDebug'  => (ENVIRONMENT !== 'production'),
        'cacheOn'  => false,
        'cacheDir' => '',
        'charset'  => 'utf8',
        'DBCollat' => 'utf8_general_ci',
        'swapPre'  => '',
        'encrypt'  => false,
        'compress' => false,
        'strictOn' => false,
        'failover' => [],
        'port'     => 3306,
    ];

    /**
     * The default database connection.
     *
     * @var array
     */
    public $oracle = [
        'DSN'      => '',
        // Local setting
        // 'hostname' => 'localhost/XE',
        // 'username' => 'system',
        // 'password' => 'password',
        // 'database' => 'mydtabase',
        // end local setting

        'DBDriver' => 'WHAT DRIVER SHOULD I USE?',
        'DBPrefix' => '',
        'pConnect' => false,
        'DBDebug'  => (ENVIRONMENT !== 'production'),
        'cacheOn'  => false,
        'cacheDir' => '',
        'charset'  => 'utf8',
        'DBCollat' => 'utf8_general_ci',
        'swapPre'  => '',
        'encrypt'  => false,
        'compress' => false,
        'strictOn' => false,
        'failover' => [],
        'port'     => 3306,
    ]; 

Try that when they release the oracle driver.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply


Messages In This Thread
RE: CODEIGNITER 4: Multiple Database Connection (MySQL and Oracle) - by InsiteFX - 10-28-2019, 03:51 AM



Theme © iAndrew 2016 - Forum software by © MyBB