Connecting ColdFusion to SQL Server 2005 Express
Tuesday, February 6th, 2007Here is a quick guide to connecting ColdFusion to a local instance of SQL Server 2005 Express.
My first attempt to do this seemingly simple task resulted in an “Error establishing socket. Connection refused: connect” error when trying to create a new data source. The cause of this error is that by default, SQL Server Express does not allow for connections over TCP/IP ports. To create the data source, we first need to configure SQL Server and enable connections over TPC/IP. The process is pretty easy, so lets get started!
First, you want to open the SQL Server Configuration Manger by choosing Start » All Programs » Microsoft SQL Server 2005 » Configuration Tools » SQL Server Configuration Manger. Next, in the left sidebar of the Configuration Manager, expand the SQL Server 2005 Network Configuration node. Now click on the Protocols for SQLEXPRESS node. Now in the right hand pane, double-click on the TCP/IP item. This will open the TCP/IP Properties window.
In the TCP/IP Properties window, choose Yes from the dropdown list in the Enabled row. Next we need to configure the IP addresses that are to receive connections on, so click on the IP Address tab. Look for the section named IPAll and enter in the port that SQL Server will listen for connections on. In the TCP Port row, type in 1433 (or any other port number you wish to use). Now click the OK button. You will be prompted to Restart the SQL Server (do this using either the Services control panel applet or by using SLQ Server Management Studio Express).
Now you should be able to connect your ColdFusion to SQL Server 2005 Express!


