Uploaded image for project: 'Doctrine DBAL'
  1. Doctrine DBAL
  2. DBAL-141

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

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: 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

          digitalmechanic Ed Anderson created issue -
          Hide
          beberlei Benjamin Eberlei added a comment -

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

          Show
          beberlei Benjamin Eberlei added a comment - Whats the difference? the Use of SID works for me.
          beberlei Benjamin Eberlei made changes -
          Field Original Value New Value
          Link This issue is duplicated by DBAL-136 [ DBAL-136 ]
          Hide
          yourwebmaker 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
          yourwebmaker 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
          digitalmechanic 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
          digitalmechanic 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
          beberlei 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
          beberlei 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
          beberlei 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
          beberlei Benjamin Eberlei added a comment - Fixed by adding a new parameter 'service' which has to be true to use SERVICE_NAME instead of SID.
          beberlei Benjamin Eberlei made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Fix Version/s 2.2 [ 10142 ]
          Resolution Fixed [ 1 ]
          beberlei Benjamin Eberlei made changes -
          Workflow jira [ 12887 ] jira-feedback2 [ 17736 ]
          beberlei Benjamin Eberlei made changes -
          Workflow jira-feedback2 [ 17736 ] jira-feedback3 [ 20091 ]

          This list may be incomplete, as errors occurred whilst retrieving source from linked applications:

          • Request to http://www.doctrine-project.org/fisheye/ failed: Error in remote call to 'FishEye 0 (http://www.doctrine-project.org/fisheye/)' (http://www.doctrine-project.org/fisheye) [AbstractRestCommand{path='/rest-service-fe/search-v1/crossRepositoryQuery', params={expand=changesets[0:20].revisions[0:29],reviews, query=DBAL-141}, methodType=GET}] : Received status code 503 (Service Temporarily Unavailable)

            People

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

              Dates

              • Created:
                Updated:
                Resolved: