开发者

MDB2 With SQL Express 2008

开发者 https://www.devze.com 2022-12-25 03:43 出处:网络
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

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 soluti开发者_StackOverflowons 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.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号