asaladino/oracle_datasource

CakePHP Oracle Datasource

v1.0 2015-01-20 20:46 UTC

This package is not auto-updated.

Last update: 2024-04-23 14:07:47 UTC


README

Connect to an Oracle database using the OCI* PHP extension.

Requirements

The master branch has the following requirements:

  • CakePHP 2.2.0 or greater.
  • PHP 5.4.0 or greater.

Installation

[Using Composer]

Add the plugin to your project's composer.json:

{
  "require": {
    "asaladino/oracle_datasource": "0.8.*"
  }
}

Because this plugin has the type cakephp-plugin set in it's own composer.json, composer knows to install it inside your /Plugin directory, rather than in the usual vendors file. It is recommended that you add /Plugin/OracleDatasource to your .gitignore file. (Why? read this.)

[Manual]

  • Download the OracleDatasource archive.
  • Unzip that download.
  • Rename the resulting folder to OracleDatasource
  • Then copy this folder into app/Plugin/

[Enable]

Add CakePlugin::loadAll(); to bootstrap.php then implement in database.php and a model.

[database.php]

class DATABASE_CONFIG {
    public $oracle = array(
        'datasource' => 'OracleDatasource.Oci',
        'persistent' => false,
        'host' => '127.0.0.1',
        'port' => '1521',
        'login' => 'user',
        'password' => 'oracle',
        'schema' => 'USER_SCHEMA',
        'sid' => 'orcl', // or service name
        'prefix' => ''
    );
}

[Your Model]

App::uses('AppModel', 'Model');

class DemoState extends AppModel {
    public $primaryKey = 'st';
    public $displayField = 'state_name';
    public $useDbConfig = 'oracle';
}