Details
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.