将原则 2 与 SQL Server 结合使用
我需要将一个基于当前 Beta 版原则 2 构建的现有项目从 mysql 迁移到 SQL Server。
我完全控制 SQL Server。
在 Doctrine 的 DBAL 文件夹中已经有一个 PDOMsSql 驱动程序,但我不知道如何使用它。 (仍然没有文档)
Doctrine还提供了另外两种方法,我也许可以使用:
- driverClass:如果没有指定“驱动程序”,则指定自定义驱动程序实现。这允许使用不属于 Doctrine DBAL 本身的自定义驱动程序。
- pdo:指定要使用的现有 PDO 实例。
有人能帮我解决这个问题吗?我不知道如何从这里开始,因为我根本没有 ODBC/PDO 和 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 no experience with ODBC/PDO and SQL Server at all.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我自己想出来了......在Mac上,“mssql.so”只提供“dblib:”作为驱动程序。因此,通过将 Doctrine 驱动程序中的 dbo_mssql 替换为“dblib”,定义 FreeTDS 主机并使用其名称作为我的连接的主机名,一切正常。
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.
您现在还可以使用 sqlsrv 或 pdosqlsrv。我今天在 Doctrine DBAL 项目中提交了对 pdosqlsrv 驱动程序的更改,修复了 DSN 创建的一些问题并使其正常工作。在我看来,Sqlsrv/pdosqlsrv 可能是可行的方法,因为 Microsoft 正在积极开发它。
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.