...
composer.json 에 laravel용 오라클 패키지인 yajra/laravel-oci8 를 추가.
Code Block { "require": { "yajra/laravel-oci8": "^7^8" } }
컴포저 업데이트 실행Code Block composer update
또는 명령행에서 실행
Code Block composer require yajra/laravel-oci8:^7^8
OCI Provider 를 laravel 의 service provider 에 등록해 줘야 함. config/app.php 를 열어서 'provides' 에 다음 내용 추가
Expand Code Block language php 'providers' => [ // 추가 Yajra\Oci8\Oci8ServiceProvider::class, ],
config/oracle.php 이 생기도록 vendor publishing 실행
Code Block php artisan vendor:publish --tag=oracle
app/database.php 에 DB 연결 정보를 추가한다.
Code Block language php title database.php <?php return [ /* |-------------------------------------------------------------------------- | Default Database Connection Name |-------------------------------------------------------------------------- | | Here you may specify which of the database connections below you wish | to use as your default connection for all database work. Of course | you may use many connections at once using the Database library. | */ 'default' => 'oracle', 'connections' => [ 'oracle' => [ 'driver' => 'oracle', 'host' => env('ORACLE_HOST'), 'port' => env('ORACLE_PORT', 1521), 'database' => env('ORACLE_SID'), 'username' => env('ORACLE_USERNAME'), 'password' => env('ORACLE_PASSWORD'), 'charset' => env('ORACLE_CHARSET','AL32UTF8'), 'prefix' => '', ], 'sqlite' => [ 'driver' => 'sqlite', 'database' => __DIR__.'/../database/production.sqlite', 'prefix' => '', ], 'mysql' => [ 'driver' => 'mysql', 'host' => 'localhost', 'database' => 'forge', 'username' => 'forge', 'password' => '', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', ], ],
.env 파일에 연결 정보를 설정한다.
Code Block ORACLE_HOST=myoracle.example.com ORACLE_PORT=1521 ORACLE_SID=mySid ORACLE_USERNAME=scott ORACLE_PASSWORD=tiger ORACLE_CHARSET=AL32UTF8
...