-
Notifications
You must be signed in to change notification settings - Fork 374
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TCP Provider: Error code 0x2746. Client unable to establish connection. #252
Comments
Connecting to the same database from the same webserver with the same credentials and using the nodejs mssql module does work, so it is not a firewall issue. |
Hi @Inwerpsel are you running your SQL Server on port 50000? The default port is 1433 so the following commands should work: The other setting to check is that TCP/IP is enabled in Sql Server Configuration Manager. |
Hi @v-dareck The version we are running is TCP/IP is enabled for this server. When searching the error code I came across this article about TLS 1.2 support. Since our server has not been updated for this, could this have something to do with the TCP error? Yes, we are running this server on port 50000. We changed it to 1433 and the problem persisted on Ubuntu. From my windows pc both commands did work. |
Hi @Inwerpsel The TLS 1.2 might be the solution but I'm not sure. Windows XP and 2008R2 SP1 are not supported anymore. However, 2008R2 SP3 is still supported: I was unable to repro your error connecting from Ubuntu 16.04 to 2008R2 SP1. I think it maybe a firewall issue with your ubuntu machine not able to connect to the sql server port. Can you telnet from your ubuntu machine to your sql server (telnet ) such as: If telnet cannot connect to the port sql server is running you will receive an error like: |
Hi. I'm the sysadmin supporting @Inwerpsel on this issue. I can confirm it's not a firewall issue. I did some network traces, and the TCP connection does get established. There some initial handshake, but pretty quickly the connection is dropped. I assume it is a protocol mismatch. |
Hi @srvg, Windows XP is not currently supported anymore and that maybe the cause of your network errors. I would try one of the following options:
|
Hi @v-dareck There is nowhere Windows XP being used here. Running SQL Server on Ubuntu is not an option. |
Hi @srvg , |
Ouch, sorry about that, overlooked it. I can't go check it myself right now. Time for a Windows upgrade either way. |
I can confirm that lack of TLS 1.2 support in Windows Server 2003 is the issue. I tested with a server that has the same SQL version but Windows Server 2008 and that works. It is impractical to upgrade windows on our servers now, but we managed to resolve the issue for now by switching to the php7.1-sybase driver and using pdo_dblib. |
I started to have this error after upgrading my Linux server packages on (Centos 7). Previously everything worked fine. I can't use php7.1-sybase driver due to some limitations with binary data fields. Is there any way to make this work with pdo_sqlsrv? My error message is following:
|
@vedmant , which SQL Server are you using? What operating system is your server on? I don't think you are experiencing the same problem as the Error code is different (yours is 0x2749, and the origin issue is 0x2746). |
@v-kaywon Versions are following: The point is that it was working perfectly until I updated Linux packages on one point. |
I'm with same problem, 1 day trying to solve |
@NaelsonBR Is it the exact same problem? What error message do you get? Can you connect with sqlcmd and isql? |
Hi, @david-puglielli sqlcmd -S localhost -U SA -P 'Abc123+' Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : TCP Provider: Error code 0x2746. Can you help me? |
My freedback, solved reinstalled ubuntu and sql server and using this guide. |
With the latest update of mssql (14.0.3223.3-15) on ubuntu 18.04 lts, i had the same connection problem, i've reinstalled the ubuntu 18 but the error still same, i installed ubuntu 16.04 lts and that's solved my problem. rest of the installation process is in this url. |
@hrnsky Does this problem only happen with the latest update of mssql? There is no mssql for Ubuntu 18.04 on packages.microsoft.com so I'm interested to know if any of the mssql packages for 16.04 work on 18.04. |
@david-puglielli Yes there is no repository for 18.04 and yes with last update (14.0.3223.3-15) i couldn't connect to the mssql, but service was running. I thought it was openssl or other ssl related package problem, because microsoft dev team said that sql 2017 won't be installed on ubuntu 18 because of ssl package dependency, after announced on this https://blogs.msdn.microsoft.com/sql_server_team/installing-sql-server-2017-for-linux-on-ubuntu-18-04-lts/ i installed it on my ubuntu 18 vps , but with last update, also a dist package update i think, this problem occured. i had to downgrade to ubuntu 16, everything is ok right now. you should (and me also) wait for an official release to use on ubuntu 18. |
I have ubuntu 18 and have been using sql-server for a while, and suddenly the issue occurred (probably after some apt-get upgrade) $ sqlcmd -S 127.0.0.1,1433 -U sa -P password
Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : TCP Provider: Error code 0x2746.
Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : Client unable to establish connection. Telnet works, and using node libraries to connect work as well. |
https://stackoverflow.com/a/57343207/2242402 solved it for me - sudo apt-get install mssql-server=14.0.3192.2-2 |
Yeah that worked, as a workaround. When will be released a complete fix? |
It seems the latest version of mssql-server may have introduced a bug. However, we do not maintain mssql-server so we cannot help. We recommend reporting these issues on the SQL Server feedback forum. Further support resources can be found here. |
Seems like 14.0.3192.2-2 is not available anymore. Anyone has some ideas?
|
Ok just figured it out. Needs to register the mssql-server 2017 repository |
as jafarulla15 mentioned , https://stackoverflow.com/questions/57265913/error-tcp-provider-error-code-0x2746-during-the-sql-setup-in-linux-through-te/57343207#57343207 resolves the issue but in my case I needed to link both libs in /lib folder , instead of /usr/lib. |
Why is this closed? I need to connect to a remote SQL Server and am getting the same error. I cannot change anything on the server. Downgrading openssl is not really an option. Running Ubuntu 20.4. |
Same problem here |
Hi @brianmsm, if you need help, please elaborate or create a new issue if necessary. |
@young-altair please provide the odbc trace when running in Ubuntu 20.04 |
I'm running Ubuntu Server 20.04 x64 using PHP 8.0 and the latest sqlsrv/pdo_sqlsrv drivers, connecting to SQL Server 2014. Hopefully this helps? Thanks in advance.
|
@plabbett with Ubuntu 20.04 and above you can't connect to a server prior to SQL Server 2017 without a workaround. Please see this related issue |
For anyone lost in this chain of links, here is the workaround solution: #1112 (comment). Otherwise, you'll probably have to change the server's TLS version to 1.2. |
I just had the same issue (unixODBC client failed to connect to MS SQL Server running on Windows Server 2012 with a TCP Provider Error code 0x2746.) The SQL server connection manager was not setup for "Force Encryption" and a certificate was not assigned. I opened the "Certificates" module in the mmc for the Windows Server (the server running SQL Server) and created a new certificate request (we have a domain policy for auto-enrolment but for some reason this server isn't enrolling.) The certificate was issued. I then ran SQL server connection manager and on the "SQL Server Network Configuration" for the SQL instance, I assigned the certificate and enabled encryption. Immediately after applying, I can connect from the unix client (Ubuntu 20.04 running Zabbix) without error. |
did you solve? |
I had same problem in the query case from sqlcmd(17.10.0001.1 Linux) to SQL Server(2012 sp4)My sqlcmd was latest version(Ubuntu20, ODBC Driver 17), and occurred 0x2746 error in several DB.
|
I am using ubuntu 16.04, php7.1 and have followed the php7.1 specific installation instructions on here: https://github.com/Microsoft/msphpsql/tree/PHP-7.0-Linux#install.
I am trying to connect to a named instance through its port number. Using pdo_sqlsrv, sqlsrv and via command line (with the sqlcmd tool like in the tutorial) I always get the same error:
user@webserver:/# sqlcmd -d database -S databaseserver,50000 -U sa -P password -Q 'select top 1 id from table'
Sqlcmd: Error: Microsoft ODBC Driver 13 for SQL Server : TCP Provider: Error code 0x2746. Sqlcmd: Error: Microsoft ODBC Driver 13 for SQL Server : Client unable to establish connection.
I know that the database server is found: when I change the port to a not used port I get a login timeout.
In the server logs of the SQL server I find this error:
Length specified in network packet payload did not match number of bytes read; the connection has been closed. Please contact the vendor of the library. [CLIENT: webserver_ip]
When executing the same command from my windows PC command line on the same network it does work.
The text was updated successfully, but these errors were encountered: