I am using Zend Framework 3 for my project. I would like to use Doctrine with Sql Server 2014. When I use Zend-Db all things are fine but using Doctrine displays me this message:
Fatal error: Invalid handle returned. in C:\Users\root\zendwithsqlserver\vendor\doctrine\dbal\lib\Doctrine\DBAL\Driver\PDOConnection.php on line 43
I have done all configurations needed for doctrine First I config my sql server database credentials in config/autoload/local like this:
<?php
use Doctrine\DBAL\Driver\PDOSqlsrv\Driver as PDOSqlsrvDriver;
return array(
'doctrine' => [
'connection' => [
'orm_default' => [
'driverClass' => PDOSqlsrvDriver::class,
'params' => [
'host' => 'localhost',
'user' => 'sa',
'password' => 'mypassword',
'dbname' => 'blog',
]
],
],
],
);
To finish in my module.config.php file located in module/Application/module/ I add the doctrine code to permit it to know where are situated my entities .
'doctrine' => [
'driver' => [
__NAMESPACE__ . '_driver' => [
'class' => 'Doctrine\ORM\Mapping\Driver\AnnotationDriver',
'cache' => 'array',
'paths' => [__DIR__ . '/../src/Entity']
],
'orm_default' => [
'drivers' => [
__NAMESPACE__ . '\Entity' => __NAMESPACE__ . '_driver'
]
]
]
]
I would like to know how can I fix this error?:
Fatal error: Invalid handle returned. in C:\Users\root\zendwithsqlserver\vendor\doctrine\dbal\lib\Doctrine\DBAL\Driver\PDOConnection.php on line 43
Any idea or suggestion is welcome, thanks in advance.