SQLSTATE[08001]: [Microsoft][ODBC Driver 17 for SQL Server]TCP Provider: Error code 0x2746
I'm using PHP Laravel 7.4 on Ubuntu 20.04 and trying to get data from SQL Server located on a Windows server in another cloud.
This method was tested on my PC (Windows) and it successfully retrieved the data from the Windows server. However, on my Ubuntu server, I follow the documentation from Microsoft and get this error:
SQLSTATE[08001]: [Microsoft][ODBC Driver 17 for SQL Server]
TCP Provider: Error code 0x2746 (SQL: myquery)
{"userId":94,"exception":"[object]
(Illuminate\Database\QueryException(code: 08001): SQLSTATE[08001]:
[Microsoft][ODBC Driver 17 for SQL Server]TCP Provider: Error code
0x2746 (SQL: myquery) at /var/www/web-api/vendor/laravel/framework/src/Illuminate/Database/Connection.php:669)I checked the logs in Microsoft SQL Server Management Studio and I notice this message appears every time I make a request from Ubuntu
"An TLS 1.2 connection request was received from a remote client application, but none of the cipher suites supported by the client application are supported by the server. The SSL connection request has failed."
How can I fix this?
1 Answer
An 08001 error occurs when an ODBC connection to a SQL Server database fails. You've mentioned two things that stand out:
- this works on your local development machine
- the SQL Server instance is running (perhaps) at another cloud provider
As the connection works from your local machine, the Username/Password is likely correct, but you will want to check. The most likely culprit, however, is going to be the firewall. Confirm that the Ubuntu Server's IP address is permitted through the firewall for the Windows Server running SQL Server.
The following ports will need to be available:
TCP: 1433, 4022, 135, 1434
UDP: 1434