Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DBAL 'instancename' and 'connectionstring' connection parameters missing #520

Closed
jamjamg opened this issue Mar 4, 2016 · 8 comments
Closed

Comments

@jamjamg
Copy link

jamjamg commented Mar 4, 2016

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%"
@jamjamg
Copy link
Author

jamjamg commented Mar 4, 2016

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'];
        }

@lecneri
Copy link

lecneri commented Mar 30, 2016

@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!

@mikeSimonson
Copy link
Contributor

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

@lecneri
Copy link

lecneri commented Mar 31, 2016

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

@mikeSimonson
Copy link
Contributor

@lecneri Thanks for the confirmation of the fix

@jamjamg
Copy link
Author

jamjamg commented Apr 2, 2016

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

@mikeSimonson
Copy link
Contributor

What is the issue with dbal.

Le sam. 2 avr. 2016 22:26, Mahi notifications@github.com a écrit :

@mikeSimonson https://github.com/mikeSimonson PR #531
#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
#520 (comment)

@jamjamg
Copy link
Author

jamjamg commented Apr 3, 2016

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 doctrine/dbal#2306 ... so this is no problem in future versions anymore.

Just these 3 lines were misisng:

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants