Error when connecting oracle

Asked

Viewed 393 times

1

I’m trying to perform operation Insert on the oracle by Laravel (5.6), but is giving error:

The method I do the Insert is this:

public function salvar( Request $request ){
        $agenda = new Agenda();
        $agenda->dt_agenda = $request->input('data');
        $agenda->hr_agenda = $request->input('hora');
        $agenda->nm_pessoa = $request->input('nome');
        $agenda->save();
        $data = date('d/m/Y');
        return view('escala')->with( 'data', $data );
    }

The config/database.php file looks like this:

 'default' => env('DB_CONNECTION', 'oracle'),
    ...
    'oracle' => [
                'driver'         => 'oracle',
                'host'           => env('DB_HOST', ''),
                'port'           => env('DB_PORT', '1521'),
                'database'       => env('DB_DATABASE', ''),
                'username'       => env('DB_USERNAME', ''),
                'password'       => env('DB_PASSWORD', ''),
                'charset'        => env('DB_CHARSET', 'AL32UTF8'),
                'prefix'         => ''
            ],

The file . env is properly configured

DB_CONNECTION=oracle
DB_HOST=ipdoservidor
DB_PORT=1521
DB_DATABASE=banco
DB_USERNAME=login
DB_PASSWORD=senha

The mistake you’re making is :

Errorexception (E_WARNING) Declaration of Yajra Oci8 Oci8connection::causedByLostConnection(Exception $e) should be compatible with Illuminate Database Connection::causedByLostConnection(Throwable $e)

My Composer.json looks like this:

"require": {
        "php": ">=7.1.3",
        "barryvdh/laravel-ide-helper": "^2.4",
        "fideloper/proxy": "~4.0",
        "laravel/framework": "5.6.*",
        "laravel/tinker": "~1.0",
        "yajra/laravel-oci8": "5.6.*"
    },

inserir a descrição da imagem aqui

1 answer

1


You have the latest version of this package?

Because the Laravel 5.6 update is recent, it is normal for incompatibilities to occur with some packages and this is fixed according to the issues opened on Github related to it.

On the tab Issues of Oracle DB driver for Laravel 4|5 via OCI8 we can see something concerning your problem in this Issue.

As we can see, the commit #407 held 8 days ago (14 Feb. 2018) fixes the problem.

  • 1

    True, I changed the json file to 5.5 and it worked.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.