Yii 1.1: oci

Oracle driver

This extension allows using AR and crud commands with Oracle database.



  • Yii 1.0 or above
  • PHP 5.2
  • Oracle 10g client


  • Extract the release file under YII_PATH\db\schema

  • In \db\CDbConnaction.php, add the following at getSchema method:

            case 'oci': // oracle
                return $this->_schema=new COciSchema($this);
  • In YII_PATH\YiiBase.php, add the path to the new classes in coreClasses:

    'COciColumnSchema' => '/db/schema/oci/COciColumnSchema.php',
    'COciSchema' => '/db/schema/oci/COciSchema.php',
    'COciTableSchema' => '/db/schema/oci/COciTableSchema.php',
    'COciCommandBuilder' => '/db/schema/oci/COciCommandBuilder.php',

Note 1: Under PHP 5.2 versions, PDO-OCI crashes on $command->prepare in Yii. I don't know exactly, but seems a problems with PHP 5.2 and Oracle 9i client.

Note 2: PHP 5.2 works correctly with Oracle 10g clients.

Note 3: I tested it on Windows, so, if you want to use other versions, maybe in Linux it can work.


Just remember that Oracle does not have autoincrement columns. To simulate that, use a combination of sequence + trigger (before insert).

Change Log

April 23, 2009

  • Initial release.

Total 2 comments

#4782 report it
Phelipe Folgierini at 2011/08/15 02:04pm
Support to tables with composite key

This extension add support to composite key in Oracle? For example, Gii CRUD Generator actually not support oracle tables with composite key. Anything about this?

#484 report it
jwheat at 2010/05/18 12:18pm
Works great -

I was excited to see Oracle support. When I went to add this, it Looks like its been rolled into baseline YII now.

One issue I had with - does it handle BLOBS ? I can't tell if the problem is YII or if it is the php pdo_oci driver. Everything I read says the driver can handle blobs, but my YII app seems to be thinking its a LONG column instead. Wierd.


Leave a comment

Please to leave your comment.

Create extension