SQLSTATE[01002] Adaptive Server connection failed (severity 9)

PHP uses dblib to connect to sqlserver. An error is reported

SQLSTATE[01002] Adaptive Server connection failed (severity 9)

solution 1:

In/usr/local/freetds/etc/freetds.conf (the specific location may be different), add:

[mssql]
host = your ip
Port = 1433
tds version = 8.0

solution 2:

Remove the version number setting under [global] in/usr/local/freetds/etc/freetds.conf and change it to 8.0

That is to say, it will; TDS version = 4.2 the semicolon in front of the line is removed and changed to:

tds version = 8.0

or

Adding version number in DSN

new PDO(” dblib:version=8.0; host=192.168.0.1:1433; dbname=test”,”test”,”pwd”);

—————————–

If not, try changing the version number to 4.2 or other possible version numbers

Similar Posts: