MDB2 与 SQL Express 2008
所以基本上这是我的问题。我正在寻找一种解决方案,允许我们连接 SQL Express 2008,同时仍然使用 MDB2 作为我们的数据库抽象层。我需要这样的东西,主要是因为我们仍然需要能够使用 MySQL 和 Postgres(并且 ORM 目前似乎不是一个选择)。
最好有一个适用于 PHP5.2 和 PHP5.3 的解决方案。
起初,我走的是 php_mysql 扩展之路……不过,这似乎在 PHP 5.3 中不可用。
php_pdo_mssql 似乎不能与 MDB2 一起使用,所以这似乎已经过时了。
最后,还有 MS 开发的“SQLSRV”扩展,虽然似乎曾经有人为它开发过 MDB2“扩展”,但它似乎从未进入过主分支。
请...有人能为我提供解决方案吗?
So basically here's my problem. I'm looking for a solution to allow us to connect with SQL Express 2008, while still using MDB2 as our database abstraction layer. I need something like this, mainly because we still need to be able to use MySQL and Postgres (and ORMs seem to be not an option at this point in time).
Preferably, there would be a solution that works for both PHP5.2 and PHP5.3.
At first I went down the php_mysql extension road... it seems, though, as though that is not available in PHP 5.3.
php_pdo_mssql doesn't seem to be usable with MDB2, so that seems to be out.
Finally, there's the MS developed 'SQLSRV' extension, and while it seems as though there was work on a MDB2 'extension' for it at one point, it doesn't seem to have ever made it into the main branch.
Please... does anyone have any solutions for me?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于其他正在寻找这方面信息的人...到目前为止,我已经让 SQL Express 2008 与在 PHP 5.2 下运行的 MDB2 一起使用。
我还没有尝试连接到远程服务器:到目前为止,我只连接到在本地主机上运行的 SQL Express。
我不确定我使用的 PHP 是否附带 php_mssql.dll 扩展:无论哪种方式,我都禁用了它。相反,我使用了从 http://docs.moodle.org/ 上的链接下载的 php_dblib.dll en/Installing_MSSQL_for_PHP 。该库是 FreeTDS 的构建(来自 freetds.org)。我还没有对它进行任何重大测试,但我可以连接到它,并且一位同事告诉我,他们正在使用它取得“实际”成功。
php_dblib.dll 为 php_mssql.dll 提供的 mssql_* 函数提供“替换”函数。因此,您需要先禁用 php_mssql.dll 扩展,然后再启用 php_dblib.dll 扩展。
其他需要注意的小事情:
1)虽然大多数有关 SQL Express 和 PHP 的文档都声明您必须在数据库连接信息的主机部分中包含“实例”名称,但我发现这对我不起作用:事实上,我必须显式删除“\SQLEXPRESS”。
2) 虽然上面的 Moodle 链接提供了 php_dblib.dll 的 PHP 5.3 版本,但不幸的是它们是用 VC9 构建的。我安装的 PHP 5.3 是用 VC6 构建的,所以我仍在为 PHP 5.3 构建我自己的 php_dblib.dll。
无论如何,我希望这可以帮助遇到同样问题的人。
For anyone else looking for information on this... so far, I have got SQL Express 2008 working with MDB2 running under PHP 5.2.
I have not yet tried connecting to a remote server: so far, I have only connected to SQL Express running on localhost.
I'm not sure if the PHP I am using shipped with the php_mssql.dll extension or not: either way, I disabled it. Instead, I used the php_dblib.dll that I downloaded from links on http://docs.moodle.org/en/Installing_MSSQL_for_PHP . This library is a build of FreeTDS (from freetds.org). I have not done any major testing with it yet, but I can connect to it, and I have been told by a colleague that they are having 'actual' success with it.
php_dblib.dll provides 'replacement' functions for the mssql_* functions that php_mssql.dll provided. Therefore, you need to disable the php_mssql.dll extension before enabling the php_dblib.dll one.
Other little things to note:
1) whereas most documentation on SQL Express and PHP state that you have to include the 'instance' name in the host section of the DB connection information, I found that this did not work for me: in fact, I had to explicitly remove the "\SQLEXPRESS".
2) while the Moodle link above provides PHP 5.3 builds of php_dblib.dll, unfortunately they are built with VC9. The install of PHP 5.3 I have was built with VC6 and so I am still working on building my own php_dblib.dll for PHP 5.3.
Anyway, I hope that this helps people who are having the same problem.