Amadiere.com

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!

12th July 2009

Nerd Dinner

Filed under: C#, MVC, Reviews — Tags: , , , — Alex Holt @ 12:30 pm

I was going to write a review on a great book I read over the last month or two called Professional ASP.NET MVC 1.0 which is published by Wrox and written collaboratively by Scott Hanselman, Scott Guthrie, Phil Haack and Rob Conery. Then I decided that one of the main things I really liked about the book was the first chapter “NerdDinner” which is a great tutorial on ASP.NET MVC 1.0.

I will first of all prefix this review with the very relevant disclaimer that I am (at this moment) a novice when it comes to MVC, which my background strongly in Classic ASP and PHP. I have a fair understanding and beginners comprehension of a lot of the core elements – but I’m still almost always looking up answers to very simple and run-of-the-mill problems.

The chapter is available online, free of charge, from ScottGu’s blog and the entire project has been added to version control at NerdDinner @ Codeplex (a useful tool when typing large amounts of text!).

The chapter covers a number of topics in addition to the core functionality of MVC, this includes things such as LINQ, Unit Testing, AJAX, Memberships & Roles and mapping software. Starting off with an empty Visual Studio, you can have a fully working NerdDinner website within an afternoons worth of work (or if you are me, a couple of nights worth).

I would highly recommend making some time to do this chapter if you are a ASP.NET developer. It will help show you the benefits and disadvantages of MVC. However, there are a few pitfalls as you are progressing through the chapter and I feel that the testing of the chapter could have been improved as there were errors and omissions scattered around as I was trying to complete it. There weren’t lots and errors were mostly ones which could be guessed and fixed without too much stress. Even in instances where you are unable to find the mistake, a look through the CodePlex site would give you a good indication as to what you were doing wrong.

I found the most frequent errors were that of ensuring the using statements were made, or a variable named differently on one page to the pages preceding. It takes me back to the good ol’ days of copying BASIC code from the back of computer magazines to make a spider walk across the screen and go up on a string from its web. Ahh, that’s classy stuff.

The book and the chapter do a great job of letting you know the key advantages and disadvantages of using MVC, outlining some of the core differences and changes to the ways in which applications are designed/developed. I particularly liked the way the application was grown and improved, simulating actual software development. Instead of the application being coded to the full application, it is initially built very basic and as the chapter goes on, layers of complexity are added bit by bit. This served for a greater understanding of how you might approach such development.

Overall, it’s one of my favourite and relevant tutorials and I highly advise finding the time to have a go at it. I’d also go so far as to say it’s very much worth spending the pennies and getting yourself a copy of the book too. It’s even sticks to the age old tradition of having funny pictures of developers on the cover and that alone is worth the dosh! :)

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