Symfony 1.4 Doctrine 1.2 MS SQL Server
By Iain Cuthbertson
Web server: Linux (Ubuntu on my dev setup), Apache, PHP 5.3, Symfony 1.4, Doctrine 1.2.
Database server: Microsoft Windows 2008 Server, MS SQL Server
Trying to get Symfony to talk to the database server has been a painful experience for the last few days. But perseverance has paid off.
Lots of Googling with trial & error has resulted in actually achieving a development setup that will mirror the eventual production setup.
Short version:
- Follow the FreeTDS and ODBC setup instructions of http://jamesrossiter.wordpress.com/2011/03/08/connecting-to-microsoft-sql-server-using-odbc-from-ubuntu-server/
- Use the following in config/databases.yml
all:
doctrine:
class: sfDoctrineDatabase
param:
dsn: dblib:dbname=datasourcename;host=sqlserver;
username: ###
password: ###
In the above snippit, replace ‘datasourcename’ with whatever you used in /etc/odbc.ini and replace ‘sqlserver’ with the name used in /etc/freetds/freetds.conf & /etc/odbc.ini
It’s late and I’ve been struggling to get this working for some time. I may expand this entry in the future if required.
References and insperation:
- http://blog.acjacinto.com/2011/11/compiling-php-with-mssql-servers-native.html
- http://www.microsoft.com/download/en/details.aspx?id=28160
- http://jamesrossiter.wordpress.com/2011/03/08/connecting-to-microsoft-sql-server-using-odbc-from-ubuntu-server/
- http://trac.symfony-project.org/wiki/HowToConnectToMSSQLServer