Answer
PROBLEM
When attempting to connect to a backend MS SQL Server database you receive an error similar to 'Failed to connect to database'.ENVIRONMENT
- GFI products with SQL support
- All supported environments
- Microsoft SQL Server (any supported version)
SOLUTION
The ‘Failed to connect to database’ error or similar errors are generally caused by the following:
- A network firewall is preventing the connection to the SQL Server (when the network path to the SQL Server will traverse a firewall)
- A local firewall such as Windows Firewall is being used:
- Check that it is not blocking the GFI Product from making outgoing connections to the SQL Server.
- Make sure that outgoing TCP connections are allowed to SQL Server.
- If a firewall is being used on the SQL Server machine make sure that it allows incoming connections and that the SQL Server port is not being blocked. By default this is TCP port 1433.
- The specified credentials are incorrect.
- Check that the username you entered exists in SQL Server and make sure that the password is correct.
- For instructions on how to configure authentication in SQL Server 2005 (or higher versions) click here.
- The named instance is not correct. If SQL Server 2005 Express edition is being used, check that the server is specified in the format COMPUTERNAME\INSTANENAME. By default this would be <COMPUTERNAME>\SQLEXPRESS.
- If you don’t know what the instance name is you can run the following case-sensitive command in the command prompt on the SQL Server to display the list of available SQL servers on the same network:
- sqlcmd -L
CAUSE
One of the above conditions is preventing the connection.