PHP code example of cakedc / cakephp-oracle-driver

1. Go to this page and download the library: Download cakedc/cakephp-oracle-driver library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

cakedc / cakephp-oracle-driver example snippets


        
return [
    'Datasources' => [
        'default' => [
            'className' => 'CakeDC\OracleDriver\Database\OracleConnection',
            'driver' => 'CakeDC\OracleDriver\Database\Driver\OracleOCI', # For OCI8
            #'driver' => 'CakeDC\\OracleDriver\\Database\\Driver\\OraclePDO', # For PDO_OCI
            'persistent' => true,           // Database persistent connection between http requests
            'host' => 'oracle11g',          // Database host name or IP address
            //'port' => 'nonstandard_port', // Database port number (default: 1521)
            'username' => 'blogs',          // Database username
            'password' => 'password',       // Database password
            'database' => 'XE',             // Database name (maps to Oracle's `SERVICE_NAME`)
            'sid' => '',                    // Database System ID (maps to Oracle's `SID`)
            'instance' => '',               // Database instance name (maps to Oracle's `INSTANCE_NAME`)
            'pooled' => '',                 // Database pooling (maps to Oracle's `SERVER=POOLED`)
            'flags' => [],                  // Database low level parameters for OCI or PDO connection. Auto-generated by default
            'encoding' => '',               // Database charset (default same as database charset)
            'init' => [],                   // Array of queries executed at connection
            'cacheMetadata' => true,        // Enable cakephp schema caching
            'server_version' => 12,        // Oracle server numeric version ex.: 11,12,19
            'autoincrement' => true,        // Enable autoincrement insteadof custom triggers in case of oracle 12+
        ]
    ]
];

    /**
     * {@inheritdoc}
     */
    public function bootstrap()
    {
        parent::bootstrap();

        $this->addPlugin(\CakeDC\OracleDriver\Plugin::class, ['bootstrap' => true]);
    }