Following online examples and the documentation for PDO I have this one line for creating a PDO object using persistent connections:
$p = new PDO('dblib:host=SOMEHOSTNAME;dbname=SOMEDB',$user,$password,[PDO::ATTR_PERSISTENT=>true]);
Example on official documentation here: http://php.net/manual/en/pdo.connections.php
The error we get:
SQLSTATE[IM001]: Driver does not support this function: driver does not support setting attributes
PDO_SQLSRV
instead. PDO_SQLSRV for more information. – Forsyth$password,[PDO::ATTR_PERSISTENT=>true]);
to$password, array(PDO::ATTR_PERSISTENT=>true));
– Forsythdblib
does not allow the setting of attributes. That's why you get the error message. Try changingdblib:
tosqlsrv:
– Forsyth