Doctrinebundle: DBAL 'instancename' and 'connectionstring' connection parameters missing

Created on 4 Mar 2016  Â·  8Comments  Â·  Source: doctrine/DoctrineBundle

It looks like the Oracle connection parameters instancename and connectstring are missing (similar to #266 ).
They are described in the documentation http://doctrine-orm.readthedocs.org/projects/doctrine-dbal/en/latest/reference/configuration.html#pdo-oci-oci8 but are not in the code. Only AbstractOracleDriver.php mentions instancename.

If someone tries to use these parameters, this error comes up:

[Symfony\Component\Config\Definition\Exception\InvalidConfigurationException]  
  Unrecognized options "connectstring, instancename" under "doctrine.dbal.connections.default"

My composer.json looks like this:

    "symfony/symfony": ">=2.6",
    "doctrine/orm": ">=2.5.0",
    "doctrine/doctrine-bundle": "~1.2",

My composer.lock has this entry for DBAL:

    "name": "doctrine/dbal",
    "version": "v2.5.4",

My config.yml:

# Doctrine Configuration
doctrine:
    dbal:
        default_connection:    default
        connections:
            # A collection of different named connections (e.g. default, conn2, etc)
            default:
                driver:        "%database_driver%"
                host:          "%database_host%"
                port:          "%database_port%"
                dbname:        "%database_name%"
                service:       %database_service%
                user:          "%database_user%"
                password:      "%database_password%"
                charset:       UTF8
                pooled:        %database_pooled%
                connectstring: "%database_connectstring%"
                instancename:  "%database_instancename%"

All 8 comments

Here is a a possible fix ("works for me").

add these lines to Doctrine\Bundle\DoctrineBundle\DependencyInjection\Configuration.php, method configureDbalDriverNode:

->scalarNode('instancename')
    ->info(
        'Optional parameter, complete whether to add the INSTANCE_NAME parameter in the connection.'.
        ' It is generally used to connect to an Oracle RAC server to select the name'.
        ' of a particular instance.'
    )
->end()
->scalarNode('connectstring')
    ->info(
        'Complete Easy Connect connection descriptor, see https://docs.oracle.com/database/121/NETAG/naming.htm.'.
        'When using this option, you will still need to provide the user and password parameters, but the other '.
        'parameters will no longer be used. Note that when using this parameter, the getHost and getPort methods'.
        ' from Doctrine\DBAL\Connection will no longer function as expected.'
    )
->end()

AbstractOracleDriver.php from Doctrine\DBAL\Driver is also affected, these lines need to be added at the beginning of getEasyConnectString:

        if (isset($params['connectstring'])) {
            return $params['connectstring'];
        }

@jamjamg dude you saved me. I was trying everything because service and servicename wasnt working and I saw this fix. Working like a charm to me!

@jamjamg @lecneri Can you confirm that the PR #531 fix this issue ?
Thanks

@mikeSimonson I follow as @jamjamg said, and I was able to connect and make a simple sql query through console. Before that, I had the error he described.

@lecneri Thanks for the confirmation of the fix

@mikeSimonson PR #531 looks good to me! Thanks!
btw: AbstractOracleDriver.php was fixed with https://github.com/doctrine/dbal/issues/2306

What is the issue with dbal.

Le sam. 2 avr. 2016 22:26, Mahi [email protected] a écrit :

@mikeSimonson https://github.com/mikeSimonson PR #531
https://github.com/doctrine/DoctrineBundle/pull/531 looks good to me, I
guess I should file an issue for Doctrine\DBAL\Driver too now?

—
You are receiving this because you were mentioned.

Reply to this email directly or view it on GitHub
https://github.com/doctrine/DoctrineBundle/issues/520#issuecomment-204801347

Hi @mikeSimonson, DBAL was missing the "connectionstring" property, so if you were using it, AbstractOracleDriver.php was silently ignoring it. But as I've seen yesterday, they already fixed it with https://github.com/doctrine/dbal/issues/2306 ... so this is no problem in future versions anymore.

Just these 3 lines were misisng:

if (isset($params['connectstring'])) {
    return $params['connectstring'];
}
Was this page helpful?
0 / 5 - 0 ratings

Related issues

soullivaneuh picture soullivaneuh  Â·  3Comments

onavascuez picture onavascuez  Â·  4Comments

dmaicher picture dmaicher  Â·  6Comments

peter-gribanov picture peter-gribanov  Â·  7Comments

alcaeus picture alcaeus  Â·  4Comments