简体   繁体   English

MDB2与SQL Express 2008

[英]MDB2 With SQL Express 2008

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. 我正在寻找一种解决方案,以允许我们连接SQL Express 2008,同时仍将MDB2用作我们的数据库抽象层。 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). 我需要这样的东西,主要是因为我们仍然需要能够使用MySQL和Postgres(此时,ORM似乎不是一个选择)。

Preferably, there would be a solution that works for both PHP5.2 and PHP5.3. 最好有一个对PHP5.2和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_mysql扩展之路……不过,似乎在PHP 5.3中不可用。

php_pdo_mssql doesn't seem to be usable with MDB2, so that seems to be out. php_pdo_mssql似乎不适用于MDB2,因此似乎已经淘汰了。

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. 最后,有一个由MS开发的“ SQLSRV”扩展,尽管似乎在某个时候针对它进行了MDB2“扩展”的工作,但它似乎从未进入主分支。

Please... does anyone have any solutions for me? 拜托...有人对我有解决方案吗?

For anyone else looking for information on this... so far, I have got SQL Express 2008 working with MDB2 running under PHP 5.2. 到目前为止,对于任何需要此信息的人来说,我都可以使用在PHP 5.2下运行的MDB2与SQL Express 2008协同工作。

I have not yet tried connecting to a remote server: so far, I have only connected to SQL Express running on localhost. 我尚未尝试连接到远程服务器:到目前为止,我仅连接到在本地主机上运行的SQL Express。

I'm not sure if the PHP I am using shipped with the php_mssql.dll extension or not: either way, I disabled it. 我不确定我使用的PHP是否带有php_mssql.dll扩展名:无论哪种方式,我都将其禁用。 Instead, I used the php_dblib.dll that I downloaded from links on http://docs.moodle.org/en/Installing_MSSQL_for_PHP . 相反,我使用了从http://docs.moodle.org/en/Installing_MSSQL_for_PHP上的链接下载的php_dblib.dll。 This library is a build of FreeTDS (from freetds.org). 该库是FreeTDS的构建(来自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. php_dblib.dll为php_mssql.dll提供的mssql_ *函数提供了“替换”功能。 Therefore, you need to disable the php_mssql.dll extension before enabling the php_dblib.dll one. 因此,您需要先禁用php_mssql.dll扩展名,然后再启用php_dblib.dll。

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". 1)尽管有关SQL Express和PHP的大多数文档都指出您必须在数据库连接信息的主机部分中包含“实例”名称,但我发现这对我不起作用:实际上,我必须明确删除“ \\ SQLEXPRESS”。

2) while the Moodle link above provides PHP 5.3 builds of php_dblib.dll, unfortunately they are built with VC9. 2)虽然上面的Moodle链接提供了php_dblib.dll的PHP 5.3构建,但不幸的是它们是使用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. 我已经使用VC6构建了PHP 5.3的安装,因此我仍在为PHP 5.3构建自己的php_dblib.dll。

Anyway, I hope that this helps people who are having the same problem. 无论如何,我希望这对遇到同样问题的人有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM