msphpsql: SQLSTATE[08S01]: [Microsoft][ODBC Driver 17 for SQL Server]TCP Provider: Error code 0x2714
PHP Driver version
- pdo_sqlsrv 5.3.0
- sqlsrv 5.3.0
SQL Server version
- Microsoft SQL Server 2008 R2 - 10.50.1600.1 (X64)
Client operating system
- Ubuntu 16.04.3
PHP version
- 7.2.1-1+ubuntu16.04.1
Microsoft ODBC Driver version
- Microsoft ODBC Driver 17 for SQL Server (libmsodbcsql-17.2.so.0.1)
Table schema
CREATE TABLE dbo.failed_jobs ( id BIGINT IDENTITY PRIMARY KEY, connection NVARCHAR(MAX) NOT NULL, queue NVARCHAR(MAX) NOT NULL, payload NVARCHAR(MAX) NOT NULL, exception NVARCHAR(MAX) NOT NULL, failed_at DATETIME DEFAULT getdate() NOT NULL ) GO
Problem description
I randomly get the following errors:
SQLSTATE[08S01]: [Microsoft][ODBC Driver 17 for SQL Server]TCP Provider: Error code 0x2714
SQLSTATE[08S02]: [Microsoft][ODBC Driver 17 for SQL Server]SMux Provider: Physical connection is not usable [xFFFFFFFF]
I tried several solutions I found but none of them seems to work, though it looks like there is an improvement:
- https://social.msdn.microsoft.com/Forums/sqlserver/en-US/95fe26d2-2e6c-4c6b-b02d-10794e92dc7a/sqlstate-08s02-smux-provider-physical-connection-is-not-usable?forum=sqldataaccess (no difference)
- #762 which is related to #756 as mentioned (slight improvement I guess but still happening)
- Turning Pooling option ON reduced the number of bug, strangely it’s not recommended to put this on on Linux environment.
This is my unixODBC version
unixODBC 2.3.7
DRIVERS............: /etc/odbcinst.ini
SYSTEM DATA SOURCES: /etc/odbc.ini
FILE DATA SOURCES..: /etc/ODBCDataSources
USER DATA SOURCES..: /home/superviseur/.odbc.ini
SQLULEN Size.......: 8
SQLLEN Size........: 8
SQLSETPOSIROW Size.: 8
By the way, I am not using the odbc.ini file as I am working with laravel PHP framework, which I presume create its own DSN string. I’ve followed the FAQ instructions by using the isql command and everything is fine.
I also checked the following compatibily documentation: https://docs.microsoft.com/en-us/sql/connect/php/system-requirements-for-the-php-sql-driver?view=sql-server-2017
If relevant:
- The servers are hosted on the same dedicated computer and both emulated on a virtual host.
- The error seem to always occur on the same table
- A complete example of a failing query from log: https://pastebin.com/s6p83xLF As you can see, on the first hand, the delete query is failing and return the infamous “TCP Provider: Error code 0x2714”, then, the insert statement fails. (In the failed_jobs table)
I do not know what I can do more, I hope I can find some help here since it’s been months I try to kill that bug. Ever since I upgraded from pdo_dblib to pdo_sqlsrv.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 1
- Comments: 52 (18 by maintainers)
Just removed DB_PORT and it worked like magic!
I had the same problem but I got to solve with this command sudo setsebool -P httpd_can_network_connect 1 RedHat Linux comes with SELinux protection enabled by default. It allows your web server to make its own network connections: Try this, which allows your web server to make its own network connections
Thanks for replying, after some investigation I managed to find the way to add the MultipleActiveResultSets instruction to the DSN. I’ve read about this feature here.
One thing disturbe me in the source code of the Laravel Framework. In the microsoft documentation it’s mentioned that this feature is disabled by default. The only option available with the Laravel Framework is “False” as per the following lines:
The new DSN string looks like the following:
sqlsrv:Server=MyIP,1433;Database=DBName;MultipleActiveResultSets=falsewhich seems to be ok with this exampleAnyway, I will keep you up to date, thanks for help.
@Kryptonien we decided to close this issue due to inactivity. Please feel free to reopen if necessary.