cdw1p

Yii2 oci8Pdo module

May 18th, 2020
302
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. --- Step Menginstall Modul
  2.  
  3. 1. Install composer (apabila belum terinstall) dengan command :
  4. ~$ apt-get install composer
  5.  
  6. 2. Setelah composer terinstall lalu selanjutnya install modul oci dengan command :
  7. ~$ composer require professionalweb/oci8Pdo "dev-master"
  8.  
  9. 3. Tambahkan class "professionalweb\oci8Pdo\Connection" sebagai pdo package, contoh :
  10. 'class' => 'professionalweb\oci8Pdo\Connection'
  11.  
  12. 4. Pada konfigurasi database tambahkan parameter untuk melakukan cache schema :
  13. 'enableQueryCache' => false,
  14. 'enableSchemaCache' => true,
  15. 'schemaCache' => 'cache',
  16. 'schemaCacheDuration' => 0,
  17. 'queryCacheDuration' => 3600,
  18.  
  19. 5. Contoh full konfigurasi :
  20.  
  21. <?php
  22. $dsn = "TNS";
  23. return [
  24. 'class' => 'professionalweb\oci8Pdo\Connection',
  25. 'dsn' => 'oci:dbname=' . $dsn . ';',
  26. 'username' => 'username',
  27. 'password' => 'password',
  28. 'enableQueryCache' => false,
  29. 'enableSchemaCache' => true,
  30. 'schemaCache' => 'cache',
  31. 'schemaCacheDuration' => 0,
  32. 'queryCacheDuration' => 3600,
  33. 'on afterOpen' => function ($event) {
  34. $event->sender->createCommand("ALTER SESSION SET NLS_DATE_FORMAT = 'MM/DD/YYYY HH24:MI:SS'")->execute();
  35. }
  36. ];
Add Comment
Please, Sign In to add comment