We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

SQL Server 2008 and Phalcon

Hi everyone, How Can I configure My Phalcon's code to communicate with Sql Server 2008 ? P.S. I use Sql dialect into My models files. Thanx.

I had same problem before and I solved it by merging Phalcon as my app skeleton and Zend_Db for database handling.

install pdo_dblib and mssql modules in linux or Microsoft sql sever driver from https://msdn.microsoft.com/en-us/library/cc296172(v=sql.105).aspx for windows then add zend-db to your composer.json

"require": {
    "zendframework/zend-db": "2.*",
  }

the initialize Zend DB and start your project ;)



5.8k

Thak you Aboozar :) I think there is another solution consists to use something called odbc which connect Models to Sql Server. I try to understand how it works :/

edited Mar '15

I'm sure that there is only 2 drivers for connecting PHP code (Models) to MS SQL Server that I mentioned in my previous post.

but If you found another driver/method please post it here too.

thanks



5.8k

Good morning, You can set ODBC on your computer to link your phalcon project to SQL Server 2008, and then you start using odbc functions.

Hi there,

Just wondering how you managed to get this working with Models? Do you have any sample code at all? I've tried using this adapter https://github.com/fishjerky/phalcon-mssql but it did not work so I want to try your method of using the Zend framework

Cheers, Dan

you can try a dialect+adapter i wrote: https://www.airaghi.net/en/2015/08/10/phalconphp-2.0.x-sql-server-connector

it supports select, update, insert and delete ...