Simone Battiato
Simone Battiato

Reputation: 91

Laravel doesn't set oracle as connection

I've some troubles setting oracle connection for laravel. This is what i did:

  1. Modified .env with properly settings, removing DB_CONNECTION="mysql"and replacing it with ORACLE_CONNECTION="oracle"

  2. Modified database.php with properly settings:

    'default' => env('ORACLE_CONNECTION', 'oracle'),
    

    'connections' => [

    'mysql' => [
        'driver' => 'mysql',
        'host' => env('DB_HOST', '127.0.0.1'),
        'port' => env('DB_PORT', '3306'),
        'database' => env('DB_NAME', 'simone'),
        'username' => env('DB_USERNAME', 'forge'),
        'password' => env('DB_PASSWORD', ''),
        'unix_socket' => env('DB_SOCKET', ''),
        'charset' => 'utf8mb4',
        'collation' => 'utf8mb4_unicode_ci',
        'prefix' => '',
        'prefix_indexes' => true,
        'strict' => true,
        'engine' => null,
    ],
    
    'oracle' => [
        'driver' => 'oracle',
        'host' => env('ORACLE_HOST', ''),
        'port' => env('ORACLE_PORT', '1521'),
        'database' => env('ORACLE_DATABASE', ''),
        'service_name' => env('ORACLE_SERVICE_NAME', ''),
        'username' => env('ORACLE_USERNAME', ''),
        'password' => env('ORACLE_PASSWORD', ''),
        'charset' => 'utf8',
    ],
    

    ],

  3. Runned php artisan config:cache but with no result, except for this:

enter image description here

OR if i remove from mysql:

enter image description here

so it always aim to a mysql connection even if it's not specfied. Is there any other cache file to consider or something similar?

Upvotes: 1

Views: 2509

Answers (1)

Dilip Hirapara
Dilip Hirapara

Reputation: 15296

I think you don't need don't need to change DB_CONNECTION to ORACLE_CONNECTION.

DB_CONNECTION=oracle
DB_TNS=magrathea
DB_PORT=3306
DB_DATABASE=heartofgold
DB_USERNAME=marvin
DB_PASSWORD=fortytw0

Please see full description hope you get help from this. http://broncodev.com/2017-06-18-laravel5-oracle/

Upvotes: 2

Related Questions