Fourteen and a half crazy frog burpers

29th July 2009

PHP Connections to MSSQL & ntwdblib.dll

Filed under: Microsoft SQL,PHP — Tags: , — Alex Holt @ 12:40 pm

One of the systems within my workplace is a PHP5 application (via Apache on Windows) that uses MySQL5.0 as its main database. However, in addition to this, it has a requirement to an old Microsoft SQL7 Server which was running Windows NT. This machine gave up the ghost and was restored to a SQL2000 machine and it began to work again.

Except from the blasted PHP application mentioned above ! The swine!

So, after digging around and debugging and limiting down the dependencies that it could be, we established that:

  • It wasn’t MDB2 which we are using to abstract the DB connections, as mssql_connect would fail also.
  • It wasn’t a change in DB name, Server name, user, password or permissions as we could connect with identical criteria from elsewhere.
  • It wasn’t a networking error, as Query Express was able to connect when ran from the web-server itself.
  • It wasn’t remembering anything about the old server as we reset the Apache instances and rebooted the entire box to see if it would help.
  • It wasn’t the code, as we had EXACTLY the same code running against the live system from our development server and it didn’t even bat an eyelid.

Eventually, we happened across a few posts that eluded to the fact that PHP5 ships with a DLL of suckiness.

The difference between the live Apache web server, compared with the development machine was that MSSQL2000 was actually installed on the development one (along with a bunch of other crap). Because this install is in place, it meant that in C:\Windows\System32 was a working and newer copy of ntwdblib.dll .

The bottom line is that the fix is simply to replace the old version of ntwdblib.dll (which comes with PHP5, noted as version: 2000.8.2.0) and replace it with version 2000.80.194.0 Once we started the Apache instances again – BOOM! Amazingness reborn! Our web-servers could see SQL 2000 instances again! Fantastic!

24th October 2008

Visual Studio 2008 & SQL 2005

Filed under: Microsoft SQL,Visual Studio — Tags: , , — Alex Holt @ 3:22 pm

I’ve had a bit of a problem of late, namely: SQL Developer Edition 2005 and installing it.

When installing Visual Studio 2008, it installs SQLExpress 2005 which is a newer version that what I originally had on disk (though arguably not after updates). The SQLExpress however, didn’t come with all the client connectivity tools such as Management Studio (the replacement Enterprise Manager if anyone still knows it by that name), so I needed to get my version of SQL on my machine.

I decided the easiest way of installing would be to remove anything SQL’y in Add/Remove Programs and then to do the same for Visual Studio, as I have installed the combo on other machines when done VS2008 after SQL2005.

This went relatively successfully and I was able to install it… almost.

SQL Install says:
SQL Server Setup failed to obtain system account information for the ASPNET account. To proceed, reinstall the .NET framework, and then run SQL Server Setup again.

What? I have the most recent version of the .NET framework on my machine and its fully patched – how can the ASPNET account not be OK? I thought that maybe SQL (being a little older), needed an older version of the .NET framework. So I removed a few editions back to version 2.0 – still no luck. Googling was only finding limited useful answers, but I eventually stumbled upon what I needed:

Open up Command Prompt and go to
“C:\Windows\Microsoft.NET\Framework\v1.1.4322″ folder and run “aspnet_regiis -i” command.

This wasn’t perfect guidance for me, as the file didn’t exist in that specific directory, but hunting around the newer versions of the framework allowed me to find the file. Upon running that, a fairly unceremonius process runs and then when you retry your install process – Jobs a good ‘un!

Maybe I didn’t do this the best way, but I eventually have achieved what I wanted to and I feel all the better for it. And that’s no bad thing!

Theme designed & built for by Alex Holt. Powered by WordPress