Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. composer.json 에 laravel용 오라클 패키지인 yajra/laravel-oci8 를 추가.

    Code Block
    {
        "require": {
            "yajra/laravel-oci8": "^7^8"
        }
    }


    컴포저 업데이트 실행

    Code Block
    composer update
  2. 또는 명령행에서 실행

    Code Block
    composer require yajra/laravel-oci8:^7^8
  3. OCI Provider 를 laravel 의 service provider 에 등록해 줘야 함. config/app.php 를 열어서 'provides' 에 다음 내용 추가

    Expand
    Code Block
    languagephp
    'providers' => [
              // 추가
            Yajra\Oci8\Oci8ServiceProvider::class,
        ],
  4. config/oracle.php 이 생기도록 vendor publishing 실행

    Code Block
    php artisan vendor:publish --tag=oracle
  5. app/database.php 에 DB 연결 정보를 추가한다.

    Code Block
    languagephp
    titledatabase.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'    => '',
            ],
    ],
  6. .env 파일에 연결 정보를 설정한다.

    Code Block
    ORACLE_HOST=myoracle.example.com
    ORACLE_PORT=1521
    ORACLE_SID=mySid
    ORACLE_USERNAME=scott
    ORACLE_PASSWORD=tiger
    ORACLE_CHARSET=AL32UTF8

...