1
votes

I am trying to write a very simple PHP script that pulls some data from my Azure SQL database and displays it. I am getting this error though.

Warning: mysql_select_db(): No connection could be made because the target machine actively refused it. in C:\xampp\htdocs\TestPage.php on line 102

I have enabled my IP in the firewall on Azure yet I still get this issue.

1
I'm a bit confused about your question. You said you're using Azure's SQL Database service? If so: That's a variant of SQL Server, not MySQL.David Makogon
Wow, I was on that for way too long. Thanks for pointing that out.Connor Mackay

1 Answers

1
votes

Just to properly close out this question: Azure SQL Database Service is specifically SQL Server. In your code, when calling mysql_select_db(), that call is specific to MySQL.

To connect to SQL Database, you'd need to call something like sqlsrv_connect().

If you indeed wanted to use MySQL, you'd need to spin it up in a VM or container (or use a 3rd-party MySQL hosting service).