Problems connecting to mssql

Hi,

I am using the library at https://github.com/fishjerky/phalcon-mssql

I have problem connecting to the mssql server.

( ! ) Strict standards: Declaration of Twm\Db\Adapter\Pdo\Mssql::executePrepared() should be compatible with Phalcon\Db\Adapter\Pdo::executePrepared(PDOStatement $statement, array $placeholders, $dataTypes) in C:\localhost\app\vendor\mssql\db\adapter\Mssql.php on line 10

My steps of integration.

1) Add namespace in config/loader.php

2) Register db to di in services.php

    $di->set('db2', function() use ($config) {
    $dbclass = 'Twm\Db\Adapter\Pdo\\' . 'Mssql';
    return new $dbclass(array(
        "host"     => 'myip',
        "username" => 'username',
        "password" => 'password',
        "dbname"   => 'dbname'
    ));
});

3) Got the error when i tried to var_dump() $this->di->get('db2') in a controller.

Any help appreciated.

The MSSQL library is not compatible with the version of Phalcon you're using. As the Github readme states:

Requirements :
- Phalcon >= 1.2.0 and <=1.3.x

Upcoming Release :
- Phalcon 2.0 support


13.9k

thanks! do you know of any mssql driver for phalcon 2.0 + ?

The MSSQL library is not compatible with the version of Phalcon you're using. As the Github readme states:

Requirements :
- Phalcon >= 1.2.0 and <=1.3.x

Upcoming Release :
- Phalcon 2.0 support

Nope, but you could try forking the existing project and implementing the necessary changes. The problem you've written is caused by mismatching method declaration, fixing it should be fairly easy:

https://github.com/fishjerky/phalcon-mssql/blob/master/test/app/library/db/adapter/Mssql.php#L276

https://github.com/phalcon/cphalcon/blob/880b4fde422c1e7a112d5546e274d12f6784442a/phalcon/db/adapter/pdo.zep#L184

public function executePrepared(\PDOStatement $statement, array $placeholders, $dataTypes)

I'm not too familiar with the changes between Phalcon 1.3 and 2.0, there might be more errors along the way.