Commit 41fc898c authored by Bob van de Vijver's avatar Bob van de Vijver

Fixes #2306. Adds support for a connect string when using Oci8

parent 02e5b61b
......@@ -296,6 +296,8 @@ pdo\_oci / oci8
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.
Complete connection descriptors are also supported. You only need to provide the following parameter, and none of the above:
- ``connectstring`` (string): Complete Easy Connect connection descriptor, see https://docs.oracle.com/cd/E11882_01/network.112/e41945/naming.htm.
pdo\_sqlsrv / sqlsrv
^^^^^^^^^^^^^^^^^^^^
......
......@@ -109,10 +109,15 @@ abstract class AbstractOracleDriver implements Driver, ExceptionConverterDriver
*
* @return string
*
* @link http://download.oracle.com/docs/cd/E11882_01/network.112/e10836/naming.htm
* @link https://docs.oracle.com/cd/E11882_01/network.112/e41945/naming.htm
*/
protected function getEasyConnectString(array $params)
{
if ( ! empty($params['connectstring'])) {
return $params['connectstring'];
}
if ( ! empty($params['host'])) {
if ( ! isset($params['port'])) {
$params['port'] = 1521;
......
......@@ -25,6 +25,25 @@ class AbstractOracleDriverTest extends AbstractDriverTest
$this->assertSame($params['user'], $this->driver->getDatabase($connection));
}
public function testReturnsDatabaseNameWithConnectDescriptor()
{
$params = array(
'user' => 'foo',
'password' => 'bar',
'connectionstring' => '(DESCRIPTION=' .
'(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521))' .
'(CONNECT_DATA=(SERVICE_NAME=baz)))'
);
$connection = $this->getConnectionMock();
$connection->expects($this->once())
->method('getParams')
->will($this->returnValue($params));
$this->assertSame($params['user'], $this->driver->getDatabase($connection));
}
protected function createDriver()
{
return $this->getMockForAbstractClass('Doctrine\DBAL\Driver\AbstractOracleDriver');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment