Search code examples
laraveloracle-databasetns

Problem in connecting with oracle database through laravel


I am getting the following error while connecting with the oracle database through laravel8 -

ORA-12154: TNS:could not resolve the connect identifier specified

Solution

  • You have to check your oracle connection's configuration. According to this a valid format on config/database.php is:

    'oracle' => [
        'driver' => 'oracle',
        'host' => 'oracle.host.ip.here',
        'port' => '1521',
        'database' => 'xe',
        'service_name' => 'sid_alias',
        'username' => 'hr',
        'password' => 'hr',
        'charset' => '',
        'prefix' => '',
    ]
    

    Ask your DBA if you are not sure of the database or service name you have to use in your case.