I have spent the last two days trying desperately to connect my symfony 1.0 application to a MS SQL Server 2008. It is just currently not possible… I believe.

Starting with SQL 2005, Microsoft decided to stop supporting the internal API from ntwdblib.dll and thus broke the mssql-connect method. Some people are still having success using the mssql-connect function with hacked/updated ntwdblib.dll files. I have not seen success with this in SQL 2008, however.

In order to avoid utilizing outdated methods, I started working with Microsoft’s new recommended method ODBC. Connecting with to the SQL Server 2008 with ODBC and basic php was simple. Therefore, I started hacking away at symfony configuration files to use the ODBC connect methods. No luck.

Symfony uses Propel for object-based database access. When selecting mssql in propel.ini or databases.yml, propel will attempt to connect using the mssql-connect dependent functions as mentioned above. Hopefully there will be full PDO (and thus ODBC) support in Propel 1.3.

Unfortunately, Propel 1.3 is not supported in Symfony 1.0. Propel 1.3 will be the default installation in Symfony 1.2. Some people may have success running a propel 1.3 plugin.

I would love to hear some success stories that contradict my findings…

, , , ,

6 Responses to “Symfony Will NOT Connect to MS SQL 2008”

  1. davak Says:

    Update. Installed SQL 2005 and the old ntwdblib.dll and left my symfony code intact. The database connected right away. Still not bug-free but much closer.

  2. sarthan Says:

    Not been able to do propel inserts directly into SQL 2005 either.

  3. xianve Says:

    Use ODBTP to connect via ODBC to SQL 2005/8
    Works great, even from Linux.

  4. davak Says:

    xianve: odbtp is a great project, but propel/symfony doesn’t support it, I believe.

  5. Connecting Windows Symfony Install to MS SQL 2005 -- See One, Do One, Teach One Says:

    […] will only work with SQL 2005 and prior.  SQL 2008 does not work.  Symfony commands are 1.0 style and other versions of symfony will need to use the updated […]

  6. krokiet Says:

    In fact it will connect now!!!
    I’m referring to Symfony v 1.2 with Propel on PDO.
    However you need to do some tricks!
    First of all - connect via ODBC!
    The second thing - configuration - in databases.yml you need to add phptype: mssql to default connection, despite correct DSN entries like ‘odbc:DRIVER={SQL Server};SERVER=10.0.0.1;DATABASE=dbname;’

    And also a few nasty HACKS are necessary, to correct bugs in Propel!!!

    I’m going to describe it fully on my blog - probably I’ll get you posted.

Leave a Reply