Tuesday, February 16, 2016

Laravel Oracle with OCI 8

Kết nối Oracle database với OCI 8

1. Cài đặt package yajra/laravel-oci8
cd /path/to/project-name/
composer require yajra/laravel-oci8
2. Cấu hình bổ sung provider trong config/app.php
Yajra\Oci8\Oci8ServiceProvider::class
3. Publish configuration (chạy nếu cần, ko bắt buộc)
php artisan vendor:publish --tag=oracle
Laravel sẽ sinh 1 file cấu hình riêng cho oracle (config/oracle.php )

4. Configure file database: config/database.php
Thêm vào 'connections' đoạn code sau:
'oracle' => array(  
  'driver' => 'oracle',  
  'host' => '10.58.x.x',  
  'port' => '1521',  
  'database' => 'orcl',  
  'username' => 'laravel',
  'password' => '123456',  
  'charset' => 'AL32UTF8',  
  'prefix' => '',
)
5. Done.

Tham khảo: https://github.com/yajra/laravel-oci8/wiki/Installation

Nếu bạn gặp khó khăn khi enable php_oci8 trên window thì xem ở đây: Enable php_oci8.dll on window

Bài tiếp: Sử dụng cùng 1 lúc 2 kết nối sang Oracle và Mysql

1 comment:

  1. Its like you read my mind! You seem to know so much about this, like you wrote the book in it or something. I think that you could do with some pics to drive the message home a little bit, but instead of that, this is great blog. A fantastic read. I'll certainly be back. capital one card login in

    ReplyDelete