[英]“could not find driver” error while connection yii2 application with sql server
I am trying to connect my yii2 basic application with sql server. 我正在尝试将yii2基本应用程序与sql server连接。 But i am getting error
但是我出错了
Database Exception – yii\db\Exception
could not find driver
Here is my connection credentials 这是我的连接凭证
'sqlserver' => [
'class' => 'yii\db\Connection',
'dsn' => 'sqlsrv:Server=localhost;dbname=TestDatabase',
'username' => 'sa',
'password' => 'test123',
'schemaMap' => [
'sqlsrv'=> [
'class'=>'yii\db\mssql\Schema',
//'defaultSchema' => 'public' //specify your schema here
]
],
],
I found that sql server drivers were missing in xampp so i added These dll files php_sqlsrv_7_nts_x64.dll php_pdo_sqlsrv_7_nts_x64.dll 我发现xampp中缺少sql服务器驱动程序,因此我添加了这些dll文件php_sqlsrv_7_nts_x64.dll php_pdo_sqlsrv_7_nts_x64.dll
and added this code in php.ini extension=php_sqlsrv_7_nts_x64.dll extension=php_pdo_sqlsrv_7_nts_x64.dll
并在php.ini
extension=php_sqlsrv_7_nts_x64.dll extension=php_pdo_sqlsrv_7_nts_x64.dll
添加了此代码
but still getting same error 但仍然出现相同的错误
What could be the solution? 有什么解决方案?
I m also getting same error 我也遇到同样的错误
Database Exception – yii\\db\\Exception 数据库异常– yii \\ db \\ Exception
Could not find driver 找不到驱动程序
But I m able connect using simple php code. 但是我可以使用简单的PHP代码进行连接。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.