Technote Details :: I cannot connect to a Microsoft SQL sever with PHAkt
Issue
When trying to configure PHAkt to connect to a Microsoft SQL server database through a direct TCP/IP connection I get an error like:
Login failed for user username. Reason: Not associated with a trusted connection
Reason
This can happen for several reasons:
- The server is configured for Windows Authentication only and the machine from which you are making the connection is not in the same domain or a domain trusted by the domain containing the SQL server.
- The server is configured for Windows Authentication only and the connecting process or the SQL user are not running as a domain account.
- The server is configured for Windows Authentication only and the connecting user is not mapped to an account in the SQL server.
- The IP of the connecting machine is not added to the list of allowed IP's in the your_site\_mmServerScripts\MMHTTPDB.php file.
- The SQL server tries to connect through a random port, but PHP (and PHAkt also) can only use port 1433 for direct TCP/IP connections.
Solution
To solve this issue, try one of the following:
- Check that the username you are trying to connect with has a Windows Account on the SQL server machine.
- Check that user the SQL server is running as is listed in the Security/Logins section of the Enterprise Manager.
- If the connecting machine is not on the same domain or in a trusted domain as the SQL server, you cannot use Windows Authentication to login to the machine. Try using the SQL Server authentication.
- Open the your_site\_mmServerScripts\MMHTTPDB.php file in Dreamweaver and check if the connecting machine IP is in the list of allowed IP's. The lines of code should look like (replace "your_IP_address" with the actual IP address of the computer trying to connect to the SQL server):
$allowed_ips = array(your_IP_address); - Check if the correct port is opened on the SQL server machine and accepting incoming connections. Use a network test program (like netstat) to check this out.
To avoid most of these problems it is recommended that you connect to the Microsoft SQL server using ODBC instead of direct connection.