Doctrine DBAL
  1. Doctrine DBAL
  2. DBAL-141

PDO Connection Failure through TNS - PDOOracle/Driver.php line 56

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.1
    • Fix Version/s: 2.2
    • Component/s: Platforms
    • Labels:
      None
    • Environment:
      CentOS 6.0, Symfony 2.0.0 (RC), PHP 5.3.6, Oracle 11g Enterprise, Oracle InstantClient 11.0.2

      Description

      On line 56 of the file ./vendor/doctrine-dbal/lib/Doctrine/DBAL/Driver/PDOOracle/Driver.php:

      The line reads:
      $dsn .= '))(CONNECT_DATA=(SID=' . $params['dbname'] . ')))'; should read $dsn .= '))(CONNECT_DATA=(SERVICE_NAME=' . $params['dbname'] . ')))';

      If both SID and SERVICE_NAME need to be available for use, then logic should be inserted to determine which method is being used.

        Issue Links

          Activity

          Hide
          Benjamin Eberlei added a comment -

          Whats the difference? the Use of SID works for me.

          Show
          Benjamin Eberlei added a comment - Whats the difference? the Use of SID works for me.
          Hide
          Daniel Lima added a comment -

          Hi Benjamin,

          There are some Oracle connections that are setup from SERVICE_NAME (without a SID).
          In my company we always use SERVICE_NAME to setup a connection and we needed to modify the OCI connection driver from Doctrine to works fine in our environment

          Take a look in: http://stackoverflow.com/questions/43866/how-sid-is-different-from-service-name-in-oracle-tnsnames-ora

          Show
          Daniel Lima added a comment - Hi Benjamin, There are some Oracle connections that are setup from SERVICE_NAME (without a SID). In my company we always use SERVICE_NAME to setup a connection and we needed to modify the OCI connection driver from Doctrine to works fine in our environment Take a look in: http://stackoverflow.com/questions/43866/how-sid-is-different-from-service-name-in-oracle-tnsnames-ora
          Hide
          Ed Anderson added a comment -

          There's a subtle difference between SID and SERVICE_NAME and I think the code should somehow account for the difference. Here's why... An SID points to a physical instance at the database level (Service Identifier). If you ask for a SID you only get one shot at the connection (and hopefully the database is up). That's the legacy method of connecting to Oracle.

          However, for environments that have HA installations of Oracle using RAC, the SERVICE_NAME is what is used to point to a database instance (instead of a physical Service ID). If a given database instance is down and you're using SID - meaning you're looking to connect to a specific database, the connection fails. If you're in an environment with multiple instances of the target database, then RAC figures out where to send you if you're using SERVICE_NAME and you will land on an useable instance. This is the typical way to connect when Oracle is load-balanced and in a high-availability environment.

          Show
          Ed Anderson added a comment - There's a subtle difference between SID and SERVICE_NAME and I think the code should somehow account for the difference. Here's why... An SID points to a physical instance at the database level (Service Identifier). If you ask for a SID you only get one shot at the connection (and hopefully the database is up). That's the legacy method of connecting to Oracle. However, for environments that have HA installations of Oracle using RAC, the SERVICE_NAME is what is used to point to a database instance (instead of a physical Service ID). If a given database instance is down and you're using SID - meaning you're looking to connect to a specific database, the connection fails. If you're in an environment with multiple instances of the target database, then RAC figures out where to send you if you're using SERVICE_NAME and you will land on an useable instance. This is the typical way to connect when Oracle is load-balanced and in a high-availability environment.
          Hide
          Benjamin Eberlei added a comment -

          How can we solve this issue in a BC way? I wouldn't know if I can just change it the way suggested and it will work for everyone.

          Show
          Benjamin Eberlei added a comment - How can we solve this issue in a BC way? I wouldn't know if I can just change it the way suggested and it will work for everyone.
          Hide
          Benjamin Eberlei added a comment -

          Fixed by adding a new parameter 'service' which has to be true to use SERVICE_NAME instead of SID.

          Show
          Benjamin Eberlei added a comment - Fixed by adding a new parameter 'service' which has to be true to use SERVICE_NAME instead of SID.

            People

            • Assignee:
              Benjamin Eberlei
              Reporter:
              Ed Anderson
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: