using doctrine 2 with SQL Server
I need to migrate an existing project, built on the current beta of doctrine 2, from mysql to SQL Server.
I have complete control of the SQL Server.
In the DBAL Folder of Doctrine there already is a PDOMsSql driver, but I can't figure out, how to use it. (there is still no documentation)
Doctrine also offers two other ways, I could maybe use:
- driverClass: Specifies a custom driver implementation if no 'driver' is specified. This allows the use of custom drivers that are not part of the Doctrine DBAL itself.
- pdo: Specifies an existing PDO instance to use.
Could anyone help me with this? I have no clue how to start here, since I have n开发者_运维知识库o experience with ODBC/PDO and SQL Server at all.
I figured it out by myself... on a mac, "mssql.so" does only provide "dblib:" as a driver. So by replacing dbo_mssql in the Doctrine Driver with "dblib", defining a FreeTDS host and using its name as the hostname for my connection, everything works fine.
You can also use sqlsrv or pdosqlsrv now. I submitted changes to the pdosqlsrv driver in the Doctrine DBAL project today that fix some things with the DSN creation and get it working. Sqlsrv/pdosqlsrv is probably the way to go imo since Microsoft is actively developing it.
精彩评论