Doctrine DBAL
  1. Doctrine DBAL
  2. DBAL-685

Add support for custom Oracle SID / Service name in PDO_Oracle driver

    Details

    • Type: Task Task
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.5
    • Component/s: None
    • Security Level: All
    • Labels:

      Description

      Some Oracle customer databases are set up having different settings for their "DBNAME" and "SID" / "SERVICE" property. (DBNAME != SID)

      So, hereing it's currently not possible to connect via the PDO_Oracle driver (Class: Doctrine\DBAL\Driver\PDOOracle\Driver) as it uses the DBNAME value by default as value for SID / SERVICE in the _constructPdoDsn() method. (DBNAME = SID)

      A solution would be to add an additional config param like "servicename" and pass it's value into _constructPdoDsn().

      An updated version of the method could look like:


      private function _constructPdoDsn(array $params)
      {
      $dsn = 'oci:';
      if (isset($params['host']) && $params['host'] != '') {
      $dsn .= 'dbname=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)' .
      '(HOST=' . $params['host'] . ')';

      if (isset($params['port']))

      { $dsn .= '(PORT=' . $params['port'] . ')'; }

      else

      { $dsn .= '(PORT=1521)'; }

      if (isset($params['servicename']) && $params['servicename'] != '')

      { $servicename = $params['servicename']; }

      else

      { $servicename = $params['dbname']; }

      if (isset($params['service']) && $params['service'] == true)

      { $dsn .= '))(CONNECT_DATA=(SERVICE_NAME=' . $servicename . ')))'; }

      else

      { $dsn .= '))(CONNECT_DATA=(SID=' . $servicename . ')))'; }

      } else

      { $dsn .= 'dbname=' . $params['dbname']; }

      if (isset($params['charset']))

      { $dsn .= ';charset=' . $params['charset']; }

      return $dsn;
      }


      The only workaround for me is right now to use the "standard" PHP OCI / OCI8 functions with the correct SID / Service in it's DSN.

        Activity

        Michl Schmid created issue -
        Steve Müller made changes -
        Field Original Value New Value
        Project Doctrine 2 - ORM [ 10032 ] Doctrine DBAL [ 10040 ]
        Key DDC-2264 DBAL-685
        Affects Version/s 2.0 [ 10067 ]
        Affects Version/s 2.0 [ 10021 ]
        Component/s ORM [ 10012 ]
        Security All [ 10000 ]
        Hide
        Steve Müller added a comment -
        Show
        Steve Müller added a comment - Patch supplied in PR: https://github.com/doctrine/dbal/pull/471
        Steve Müller made changes -
        Assignee Benjamin Eberlei [ beberlei ] Steve Müller [ deeky666 ]
        Steve Müller made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        Benjamin Eberlei made changes -
        Status In Progress [ 3 ] Resolved [ 5 ]
        Fix Version/s 2.5 [ 10523 ]
        Resolution Fixed [ 1 ]

        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={query=DBAL-685, expand=changesets[0:20].revisions[0:29],reviews}, methodType=GET}] : Received status code 503 (Service Temporarily Unavailable)

          People

          • Assignee:
            Steve Müller
            Reporter:
            Michl Schmid
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: