Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

May be a bug or dumb user? - Connecting to Oracle

when I try run this code bellow on controller, its fine! returns data from database:

         $test = new Phalcon\Db\Adapter\Pdo\Oracle(array(
             'adapter'     => 'Oracle',
             'username'    => 'SAAS',
             'password'    => 'saas',
             'dbname'      => '//',
             'schema' => 'SAAS'
         $rs=$test->query("select * from USERS");

It's ok! returns data from oracle DB.

When I run this code below, hoping to use the connection as defined in config.:

   $user = new Users();
         $user->name = 'leandro';
         $user->email = '';
         $user->id = 1;

My database config session:

     'database' => array(
         'adapter'     => 'Oracle',
         'username'    => 'TEKNISA_SAAS',
         'password'    => 'teknisa',
         'host'        => '',
         'dbname'      => 'XE',
         'schema'      => 'TEKNISA_SAAS'

Dont works! :-(

Returns error:

SQLSTATE[HY000] [2002] No connection could be made because the target machine actively refused it. (translated from portuguese)

*Trace *

     Class: PDO
     Function:__construct Array ( [0] => mysql:host=;dbname=XE;schema=SAAS [1] => SAAS [2] => saas [3] => Array ( [3] => 2 ) ) 
     Class: Phalcon\Db\Adapter\Pdo
     Function:connect Array ( [0] => Array ( [host] => [username] => SAAS [password] => saas [dbname] => XE [schema] => SAAS ) ) 
     Class: Phalcon\Db\Adapter\Pdo
     Function:__construct Array ( [0] => Array ( [host] => [username] => SAAS [password] => saas [dbname] => XE [schema] => SAAS ) )

edited Apr '14

I believe this is a bug in the config class because even defining an Oracle adapter is being instantiated the Mysql adapter.

I commented to the config database session and created the adapter instance in the oracle bootstrap and set the oracle adapter in di as follows and it worked perfectly.

$config = array(

         "dbname" => "//",
         "username" => "SAAS",
         "password" => "saas"
     $connection = new Phalcon\Db\Adapter\Pdo\Oracle($config);

@Leandro: I've re-formatted your post with better code highlighting. "Edit" your post to see what I did, or look at the help to learn more:


In this part of my devtolols Phalcon DevTools (2.0.7) remains unreacted expecting something from the web interface is the same if I specify the schema name, otherwise tells me that the table does not exist