Connecting to MS SQL database as secondary database connection Failing

I started by looking at this code

instead of 'driver' => 'c5_pdo_mysql' i used 'driver' => 'c5_pdo_sqlsrv',

but then ran into an error because there was not class for it, so I created

Now i get error

Class '\Concrete\Core\Database\Driver\PDOSqlsrv\Driver' not found

Though the file is there.

Maybe I just went in the wrong direction. Any assisntance is appreciated.

View Replies:
exchangecore replied on at Permalink Reply
Take a look at

By default ONLY the c5_pdo_mysql driver is registered, you need to register the appropriate driver. So you database.php file in your config might end up looking something closer to this:

return array(
    'default-connection' => 'concrete',
    'drivers' => array(
        'pdo_sqlsrv' => 'Doctrine\DBAL\Driver\SQLSrv\Driver'
    'connections' => array(
        'concrete' => array(
            'driver' => 'c5_pdo_mysql',
            'server' => 'localhost',
            'database' => 'c5',
            'username' => 'uuuuuuuuu',
            'password' => 'pppppppppp',
            'charset' => 'utf8',

Notice how I had to register my driver as 'pdo_sqlsrv', and map it to an actual driver implementation class. You'll need to find the appropriate driver for your needs. Best of luck!
wavemedia replied on at Permalink Reply
SO instead of the SQLsrv driver, I have PDOSqlsrv on my system, so i changed your code for driver array to

'pdo_sqlsrv' => 'Doctrine\DBAL\Driver\PDOSqlsrv\Driver'

only thing is now i get an error

Call to undefined method Doctrine\DBAL\Driver\PDOStatement::fetchRow()

Im going to try to get SQLSrv installed on on server, but not sure if that will do it.
exchangecore replied on at Permalink Reply
Nope fetchRow is a deprecated concrete5 function. It's new form is just ->fetch() which should be common across the other doctrine drivers I believe.

For a list of these check out Concrete\Core\Database\Driver\PDOStatement they are just there for backwards compatibility but you shouldn't be using them in new development.