You can also get this if the database does not have TCP/IP enabled.
Depending on what database version you have also check the database configuration.
1. Started Microsoft SQL Server 2005 Configuration Manager.
2. Under SQL Server 2005 Network Configuration > Protocols I enabled TCP/IP Protocal for the database instance.