Technical Bits
26th July 2007
Getting Microsoft SQL Express Server working over the network and talking to it using PHP
At work we have just bought a new streaming video server, that uses Microsoft SQL Express Server 2005 to store clip information. In it's "out of the box" state the SQL server on this box was set up to listen only for local connections, as this is all it needs to run. However we wanted to use the clip information on our intranet site which meant connecting to the media server database from the web server.This wasn't as straight forward as it should have been. I went into the Configuration Manager and found the TCP/IP section (figure 1), which seemed a good place to start.

Figure 1

Figure 2

Figure 3
Unicode data in a Unicode-only collation or ntext data cannot be sent to clients using DB-Library (such as ISQL) or ODBC version 3.7 or earlier.
It turns out that the PHP function can't cope with the ntext fields in the SQL Express Database. We needed to use the SQL "Cast" function to get around it:SELECT CAST(ntext_field_name AS VARCHAR) FROM table_name
There maybe some other, better way around it but this is enough for our needs.
-