title: Cannot connect database oracle with symfony2
body: <p>what i need</p>
  
  <ul>
  <li><p>i need to connect oracle database with symfony2.</p></li>
  <li><p>i have checked by php -m</p>
  
  <ul>
  <li>oci8</li>
  <li><p>pdo_odbc</p></li>
  <li><p>odbc</p></li>
  </ul></li>
  </ul>
  
  <p>here is the link i follow <a href="https://gist.github.com/johnkary/6481664" rel="nofollow">https://gist.github.com/johnkary/6481664</a></p>
  
  <p>a.)config.yml</p>
  
  <h1>Doctrine Configuration</h1>
  
  <pre><code> doctrine:
  dbal:
      default_connection:   default
      connections:
          default:
              driver:   "%database_driver%"
              host:     "%database_host%"
              port:     "%database_port%"
              dbname:   "%database_name%"
              user:     "%database_user%"
              password: "%database_password%"
              charset:  "%database_charset%"
  </code></pre>
  
  <p>b.) parameter.yml</p>
  
  <pre><code>  # If connecting via SID
   parameters:
  database_driver:   oci8
  database_host:     abc
  database_port:     '1521'
  database_name:     test
  database_user:     aa
  database_password: aa
  database_charset:  AL32UTF8
  mailer_transport: smtp
  mailer_host: 127.0.0.1
  mailer_user: null
  mailer_password: null
  locale: en
  secret: zzzz
  </code></pre>
  
  <p>c.)services.orcale.yml</p>
  
  <pre><code> services:
  acme.doctrine.dbal.events.oracle_session_init.listener:
      class: %doctrine.dbal.events.oracle_session_init.class%
      tags:
          - { name: doctrine.event_listener, event: postConnect }
  acme.doctrine.dbal.oracle_platform.type_mapping.listener:
      class: Acme\MisBundle\Listener\OracleDoctrineTypeMappingListener
      tags:
          - { name: doctrine.event_listener, event: postConnect }
  </code></pre>
  
  <ul>
  <li><p>then run symfony database cmd</p>
  
  <pre><code> php bin/console doctrine:database:create
  </code></pre></li>
  </ul>
  
  <p>error:</p>
  
  <pre><code> cannot create database test for connection named default.
   notice: undefined index dbname
  </code></pre>
  
  <ul>
  <li><p>i have googled a day but i think there are few developer who works with symfony2 and oracle.</p></li>
  <li><p>i had made simple php script that works to test connections</p>
  
  <pre><code>$userName = ""; $password = ""; $dtabasePort = "1521"; $serverName = "";
  
  $databaseName = "testingdb";
  $c = oci_connect($userName, $password, '(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = host)(PORT = 1521)) (CONNECT_DATA = (SERVICE_NAME = ) (SID =)))');
  
   print_r($c);
  </code></pre></li>
  </ul>
  
  <p>output </p>
  
  <pre><code>       Resource id #3
  </code></pre>
  
  <p>tsnames.ora</p>
  
  <pre><code>    test=
  
         (DESCRIPTION =
          (ADDRESS = (PROTOCOL = TCP)(HOST = sss)(PORT = 1521))
            (CONNECT_DATA = (SID = test))
           )
  </code></pre>
  
  <ul>
  <li><p>i have worked sf3 and mysql but im new to oracle thats why i don"t knew how to connect oracle db with symfony.</p></li>
  <li><p>please give some solution where i have done wrong.</p></li>
  <li><p>Can anyone suggest in steps how to connect oracle db with sf2/3 is most appreciated.</p></li>
  <li><p>link of github relies same issue that im facing <a href="https://github.com/doctrine/dbal/issues/1564" rel="nofollow">https://github.com/doctrine/dbal/issues/1564</a></p>
  
  <ul>
  <li><p>i have also changed the parameter.yml file</p>
  
  <pre><code> parameters:
   database_driver: oci8
   database_user: &lt;user&gt;
   database_password: &lt;password&gt;
   database_charset: WE8MSWIN1252
   database_name: (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=&lt;host&gt;)(PORT=&lt;port&gt;))(CONNECT_DATA=(SERVICE_NAME=&lt;service_name&gt;)))
  </code></pre></li>
  </ul></li>
  </ul>
  
  <p>then error you have requested non-existence parameter "database_host"</p>
  
  <p>last &amp; final solution i tried but didn"t worked i think there bug in sf2 for oracle</p>
  
  <pre><code>    parameters:
  
          database_driver: oci8    
          database_host: 
          database_port: 1521
          database_name: 
          database_user: 
          database_password: 
          domain_name: 
  
       doctrine:
          dbal:
              default_connection:   default
              connections:
                  default:
                      driver:   "%database_driver%"
                      host:     "%database_host%"
                      port:     "%database_port%"
                      dbname:   "%database_name%"
                      user:     "%database_user%"
                      password: "%database_password%"
                      charset:  UTF8
                      persistent: true
          orm:
              auto_generate_proxy_classes: "%kernel.debug%"
              auto_mapping: true
      services:
           pdo:
              class: PDO
              arguments:
                  - "oci8:Server=%database_host%;Database=%database_name%"
                  - "%database_user%"
                  - "%database_password%"
              calls:
                  - [setAttribute, [3, 2]] # \PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION
  
           session.handler.pdo:
              class:     ESERV\MAIN\FrameworkChanges\MtlPdoSessionHandler
              arguments: ["@pdo", "%pdo.db_options%"]   
  </code></pre>