notnotundefined
notnotundefined

Reputation: 3751

Connecting Doctrine with Oracle using oci8 not happening

I am trying to connect Doctrine with Oracle. I have installed oci8 driver & enabled it in php.ini. I have set up the config in global.php as

   'doctrine' => array(
    'connection' => array(
        'orm_default' => array(
 //         'driverClass' => 'Doctrine\DBAL\Driver\PDOMySql\Driver',
            'driverClass' => 'Doctrine\DBAL\Driver\PDOOracle\Driver',
            'params' => array(
                'host'     => '192.168.4.136',
                'port'     => '1521',
                'user'     => 'DRUPAL_SYS',
                'password' => 'drupal_sys123',
                'dbname'   => 'testDB',
                'driver'   => 'oci8',
                'servicename'=>'MYService'
            )
        )
    )
)

Now, I am trying to generate entities from existing database by the following command. The command is fine as it works with MySQL.

  ./vendor/doctrine/doctrine-module/bin/doctrine-module orm:convert-mapping --namespace="Album\\Entity\\" --force  --from-database annotation ./module/Album/src/

It throws the following error enter image description here

Please help

It seems more to do with ZF2 as it works with simple php code. This sample code works.

   <?php
     error_reporting(E_ALL);
     ini_set('display_errors', 'On');
     $conn = oci_connect('DRUPAL_SYS', 'drupal_sys123', '192.168.4.136:1521/MYService');

     $stid = oci_parse($conn, 'select table_name from user_tables');
     oci_execute($stid);

Upvotes: 1

Views: 3450

Answers (1)

ste
ste

Reputation: 21

I think you should replace

'driverClass' => 'Doctrine\DBAL\Driver\PDOOracle\Driver',

with

'driverClass' => 'Doctrine\DBAL\Driver\OCI8\Driver',

Upvotes: 2

Related Questions