I am getting
Invalid query An attempt was made to access a socket in a way forbidden by its access permissions error
I am trying to connect to my azure sql server using php. I have the following code:
$serverName = "cosy.database.windows.net, 1433"; //serverName\instanceName
$connectionInfo = array( "Database"=>"cosy", "UID"=>"eocribin", "PWD"=>"password");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn ) {
echo "Connection established.<br />";
$query = sprintf("SELECT username FROM Users
WHERE username=eoin");
$result = mysql_query($query);
echo $result;
// Check result
// This shows the actual query sent to MySQL, and the error. Useful for debugging.
if (!$result) {
$message = 'Invalid query: ' . mysql_error() . "
";
$message .= 'Whole query: ' . $query;
die($message);
}
Not sure if it's problem with the query or the actual permissions to the database but I do get connection successful followed by the error so I know it is connection.