Sqlcmd error microsoft odbc driver 17 for sql server tcp provider error code 0x2746

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 ...

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


Closed

Inwerpsel opened this issue

Jan 25, 2017

· 39 comments

Comments

@Inwerpsel

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.

@Inwerpsel

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.

@v-dareck

Hi @Inwerpsel are you running your SQL Server on port 50000?
Also what version of SQL Server are you using?

The default port is 1433 so the following commands should work:
sqlcmd -d database -S databaseserver,1433 -U sa -P password -Q 'select top 1 id from table'
or
sqlcmd -d database -S databaseserver -U sa -P password -Q 'select top 1 id from table'

The other setting to check is that TCP/IP is enabled in Sql Server Configuration Manager.

@Inwerpsel

Hi @v-dareck

The version we are running is
Microsoft SQL Server 2008 R2 (SP1) - 10.50.2500.0 (Intel X86) Jun 17 2011 00:57:23 Copyright (c) Microsoft Corporation Standard Edition on Windows NT 5.2 <X86> (Build 3790: Service Pack 2) (Hypervisor)

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.

@v-dareck

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:
https://support.microsoft.com/en-us/lifecycle/search?alpha=Microsoft%20SQL%20Server%202008%20R2

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:
user@ubuntu:~$ telnet sqlserver 1433
Trying 192.168.227.11…
Connected to sqlserver.
Escape character is ‘^]’.

If telnet cannot connect to the port sql server is running you will receive an error like:
user@ubuntu:~$ telnet sqlserver 1433
Trying 192.168.227.11…
telnet: Unable to connect to remote host: Connection refused

@srgvg

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.

@v-dareck

@srgvg

Hi @v-dareck

There is nowhere Windows XP being used here. Running SQL Server on Ubuntu is not an option.
@Inwerpsel can you confirm what version of WIndows the server is running on?

@v-dareck

Hi @srvg ,
Above @Inwerpsel said Microsoft Corporation Standard Edition on Windows NT 5.2.
So this could be Windows XP or Windows Server 2003. Windows 2003 is not supported either.

@srgvg

Ouch, sorry about that, overlooked it. I can’t go check it myself right now. Time for a Windows upgrade either way.

@Inwerpsel

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.

@vedmant

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:

Sqlcmd: Error: Microsoft ODBC Driver 13 for SQL Server : Login timeout expired.
Sqlcmd: Error: Microsoft ODBC Driver 13 for SQL Server : TCP Provider: Error code 0x2749.
Sqlcmd: Error: Microsoft ODBC Driver 13 for SQL Server : A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online..
chrisbrady, jsierra-snia, cpursley, lifeinchords, Bindu123-idexx, b13i, AskoldMakaruk, saeidjoker, JanMouwes, schmite, and 2 more reacted with thumbs up emoji

@yukiwongky

@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).

@vedmant

@v-kaywon Versions are following:
Windows Server 2003 R2 SP2
SQL Server 9.0.2204

The point is that it was working perfectly until I updated Linux packages on one point.

@yukiwongky

@vedmant , were you able to connect with sqlcmd? Can you try strace -tt sqlcmd -S <servername> -U <username> -P <password> ? Also, is it possible for you to upgrade you Server? Another thing you may want to try is to update to ODBC 17 as mentioned in #468.

@NaelsonBR

I’m with same problem, 1 day trying to solve

@david-puglielli

@NaelsonBR Is it the exact same problem? What error message do you get? Can you connect with sqlcmd and isql?

@NaelsonBR

Hi, @david-puglielli
Formatted desktop, reinstalled step the step solved yesterday, more I got up of bed today, started and problem back.
When restart computer he for working.
Used Ubuntu 18.04.1 LTS.
Two month ago i no have this type of problem.

sqlcmd -S localhost -U SA -P ‘Abc123+’
sqlcmd -S 192.168.0.xxx\Express,1433 -U SA -P ‘Admin123’

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.

Can you help me?

@NaelsonBR

@hrnsky

My freedback, solved reinstalled ubuntu and sql server and using this guide.
I’ve run several sqlcmd commands and okay so far.
https://www.microsoft.com/en-us/sql-server/developer-get-started/php/ubuntu/

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.

@david-puglielli

@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.

@hrnsky

@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.

@regevbr

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.

@regevbr

poltpolt, ruhrie, milkdoes, AlexKryvets, kt215, dvergeylen, Serzh470, ahuezo, jalfcolombia, alecs, and 10 more reacted with thumbs up emoji
kt215, anwinged, cryalp, flaviosantos83, and kkalamarski reacted with hooray emoji
QSpSchool, anwinged, kkalamarski, gitbali, and wesleynunes reacted with heart emoji

@francescorossetti

Yeah that worked, as a workaround. When will be released a complete fix?

@david-puglielli

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.

@yingliangzhang

Seems like 14.0.3192.2-2 is not available anymore. Anyone has some ideas?

sudo apt-get install mssql-server=14.0.3192.2-2
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Version '14.0.3192.2-2' for 'mssql-server' was not found

@yingliangzhang

Ok just figured it out. Needs to register the mssql-server 2017 repository
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
sudo add-apt-repository "$(wget -qO- https://packages.microsoft.com/config/ubuntu/16.04/mssql-server-2017.list)"

@jafarulla15

@quqnuss

@RadBoris

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.

alierdogan7, thomas15v, flipbit03, RicardoQLG, ocomsoft, qaxi, taavs, dfsnow, torkashvand, djhurio, and 5 more reacted with thumbs up emoji

@brianmsm

@yitam

Hi @brianmsm, if you need help, please elaborate or create a new issue if necessary.

@young-altair

The database is on a public server (Windows Server 2019 + SQL Server 2019).
I was successfully connected using sqlcmd -ODBC 17 (Ubuntu 20.04 Desktop).
image

both PHP extensions are already enabled
image
image

But the result in my code (PHP 7.4-Laravel 8.12) still fail to connect.

exception: "Illuminate\Database\QueryException" file: "/var/www/elemen4/backend/vendor/laravel/framework/src/Illuminate/Database/Connection.php" line: 678 message: "SQLSTATE[08001]: [Microsoft][ODBC Driver 17 for SQL Server]TCP Provider: Error code 0x2746 (SQL: select count(*) as aggregate from [users] where [username] = 4022966 and [row_status] = 1)" trace: [,…]

I tried the same code on the Windows operating system, the connection went well. I’m using dual OS (Windows 10 64Bit and Ubuntu 20.04)

@yitam

@young-altair please provide the odbc trace when running in Ubuntu 20.04

@plabbett

@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.

select @@version;

Microsoft SQL Server 2014 (SP3-CU4-GDR) (KB4583462) - 12.0.6433.1 (X64)   Oct 31 2020 02:54:45   Copyright (c) Microsoft Corporation  Standard Edition (64-bit) on Windows NT 6.3 <X64> (Build 9600: ) (Hypervisor) 

`sqlcmd -S hostname,12345 -U user -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.

PHP error

SQLSTATE[08001]: [Microsoft][ODBC Driver 17 for SQL Server]TCP Provider: Error code 0x2746 (SQL: select * from test)

lsb_release -a

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.2 LTS
Release:        20.04
Codename:       focal

php --ri sqlsrv

sqlsrv

sqlsrv support => enabled
ExtensionVer => 5.9.0

Directive => Local Value => Master Value
sqlsrv.WarningsReturnAsErrors => On => On
sqlsrv.LogSeverity => 0 => 0
sqlsrv.LogSubsystems => 0 => 0
sqlsrv.ClientBufferMaxKBSize => 10240 => 10240
sqlsrv.SetLocaleInfo => 2 => 2

php --ri pdo_sqlsrv

pdo_sqlsrv

pdo_sqlsrv support => enabled
ExtensionVer => 5.9.0

Directive => Local Value => Master Value
pdo_sqlsrv.log_severity => 0 => 0
pdo_sqlsrv.client_buffer_max_kb_size => 10240 => 10240
pdo_sqlsrv.report_additional_errors => 1 => 1
pdo_sqlsrv.set_locale_info => 2 => 2

strace -tt sqlcmd -S database.test,12345 -U username -P 'password'

07:48:21.496550 execve("/opt/mssql-tools/bin/sqlcmd", ["sqlcmd", "-S", "database.test,12345", "-U", "username", "-P", "password"], 0x7ffe53bc7848 /* 26 vars */) = 0
07:48:21.500883 brk(NULL)               = 0x1b23000
07:48:21.500997 arch_prctl(0x3001 /* ARCH_??? */, 0x7ffdd8ed07a0) = -1 EINVAL (Invalid argument)
07:48:21.501208 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
07:48:21.501345 openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
07:48:21.501459 fstat(3, {st_mode=S_IFREG|0644, st_size=72511, ...}) = 0
07:48:21.501570 mmap(NULL, 72511, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fc08018b000
07:48:21.501908 close(3)                = 0
07:48:21.502084 openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libdl.so.2", O_RDONLY|O_CLOEXEC) = 3
07:48:21.502187 read(3, "177ELF2113>1 22"..., 832) = 832
07:48:21.502267 fstat(3, {st_mode=S_IFREG|0644, st_size=18816, ...}) = 0
07:48:21.502339 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fc080189000
07:48:21.502414 mmap(NULL, 20752, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fc080183000
07:48:21.502485 mmap(0x7fc080184000, 8192, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1000) = 0x7fc080184000
07:48:21.502559 mmap(0x7fc080186000, 4096, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x3000) = 0x7fc080186000
07:48:21.502685 mmap(0x7fc080187000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x3000) = 0x7fc080187000
07:48:21.502803 close(3)                = 0
07:48:21.502871 openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libodbc.so.2", O_RDONLY|O_CLOEXEC) = 3
07:48:21.502945 read(3, "177ELF2113>1340q"..., 832) = 832
07:48:21.503017 fstat(3, {st_mode=S_IFREG|0755, st_size=2453791, ...}) = 0
07:48:21.503090 mmap(NULL, 2565912, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fc07ff10000
07:48:21.503163 mprotect(0x7fc07ff78000, 2093056, PROT_NONE) = 0
07:48:21.503235 mmap(0x7fc080177000, 32768, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x67000) = 0x7fc080177000
07:48:21.503308 mmap(0x7fc08017f000, 14104, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fc08017f000
07:48:21.503379 close(3)                = 0
07:48:21.503445 openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libstdc++.so.6", O_RDONLY|O_CLOEXEC) = 3
07:48:21.503517 read(3, "177ELF21133>1240341t"..., 832) = 832
07:48:21.516818 fstat(3, {st_mode=S_IFREG|0644, st_size=1952928, ...}) = 0
07:48:21.516986 mmap(NULL, 1968128, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fc07fd2f000
07:48:21.517081 mprotect(0x7fc07fdc5000, 1286144, PROT_NONE) = 0
07:48:21.517184 mmap(0x7fc07fdc5000, 983040, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x96000) = 0x7fc07fdc5000
07:48:21.517286 mmap(0x7fc07feb5000, 299008, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x186000) = 0x7fc07feb5000
07:48:21.517395 mmap(0x7fc07feff000, 57344, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1cf000) = 0x7fc07feff000
07:48:21.517499 mmap(0x7fc07ff0d000, 10240, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fc07ff0d000
07:48:21.517612 close(3)                = 0
07:48:21.517717 openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libgcc_s.so.1", O_RDONLY|O_CLOEXEC) = 3
07:48:21.517847 read(3, "177ELF2113>13405"..., 832) = 832
07:48:21.517960 fstat(3, {st_mode=S_IFREG|0644, st_size=104984, ...}) = 0
07:48:21.518058 mmap(NULL, 107592, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fc07fd14000
07:48:21.518170 mmap(0x7fc07fd17000, 73728, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x3000) = 0x7fc07fd17000
07:48:21.518270 mmap(0x7fc07fd29000, 16384, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x15000) = 0x7fc07fd2900007:48:21.518370 mmap(0x7fc07fd2d000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x18000) = 0x7fc07fd2d000
07:48:21.518475 close(3)                = 0
07:48:21.518573 openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libpthread.so.0", O_RDONLY|O_CLOEXEC) = 3
07:48:21.518690 read(3, "177ELF2113>1220201"..., 832) = 832
07:48:21.518856 pread64(3, "4243GNU345Ga367265T320374301V)Yf]223337"..., 68, 824) = 68
07:48:21.518962 fstat(3, {st_mode=S_IFREG|0755, st_size=157224, ...}) = 0
07:48:21.519100 pread64(3, "4243GNU345Ga367265T320374301V)Yf]223337"..., 68, 824) = 68
07:48:21.519215 mmap(NULL, 140408, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fc07fcf1000
07:48:21.519355 mmap(0x7fc07fcf8000, 69632, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x7000) = 0x7fc07fcf8000
07:48:21.519491 mmap(0x7fc07fd09000, 20480, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x18000) = 0x7fc07fd0900007:48:21.519583 mmap(0x7fc07fd0e000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1c000) = 0x7fc07fd0e000
07:48:21.519735 mmap(0x7fc07fd10000, 13432, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fc07fd10000
07:48:21.519871 close(3)                = 0
07:48:21.519992 openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
07:48:21.520125 read(3, "177ELF21133>1360q2"..., 832) = 832
07:48:21.520230 pread64(3, "64@@@"..., 784, 64) = 784
07:48:21.520322 pread64(3, "4205GNU230043", 32, 848) = 32
07:48:21.520422 pread64(3, "4243GNUt233222%2742603203133132610204276X>263"..., 68, 880) = 68
07:48:21.520521 fstat(3, {st_mode=S_IFREG|0755, st_size=2029224, ...}) = 0
07:48:21.520625 pread64(3, "64@@@"..., 784, 64) = 784
07:48:21.520727 pread64(3, "4205GNU230043", 32, 848) = 32
07:48:21.520819 pread64(3, "4243GNUt233222%2742603203133132610204276X>263"..., 68, 880) = 68
07:48:21.520923 mmap(NULL, 2036952, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fc07faff000
07:48:21.521008 mprotect(0x7fc07fb24000, 1847296, PROT_NONE) = 0
07:48:21.521095 mmap(0x7fc07fb24000, 1540096, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x25000) = 0x7fc07fb24000
07:48:21.521183 mmap(0x7fc07fc9c000, 303104, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x19d000) = 0x7fc07fc9c000
07:48:21.521265 mmap(0x7fc07fce7000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1e7000) = 0x7fc07fce7000
07:48:21.521339 mmap(0x7fc07fced000, 13528, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fc07fced000
07:48:21.521435 close(3)                = 0
07:48:21.521509 openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libm.so.6", O_RDONLY|O_CLOEXEC) = 3
07:48:21.521577 read(3, "177ELF21133>1300363"..., 832) = 832
07:48:21.521664 fstat(3, {st_mode=S_IFREG|0644, st_size=1369352, ...}) = 0
07:48:21.521734 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fc07fafd000
07:48:21.521812 mmap(NULL, 1368336, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fc07f9ae000
07:48:21.521864 mmap(0x7fc07f9bd000, 684032, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xf000) = 0x7fc07f9bd000
07:48:21.521919 mmap(0x7fc07fa64000, 618496, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xb6000) = 0x7fc07fa64000
07:48:21.521973 mmap(0x7fc07fafb000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x14c000) = 0x7fc07fafb000
07:48:21.522029 close(3)                = 0
07:48:21.522095 mmap(NULL, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fc07f9ab000
07:48:21.522158 arch_prctl(ARCH_SET_FS, 0x7fc07f9ab740) = 0
07:48:21.522248 mprotect(0x7fc07fce7000, 12288, PROT_READ) = 0
07:48:21.522312 mprotect(0x7fc07fafb000, 4096, PROT_READ) = 0
07:48:21.522364 mprotect(0x7fc07fd0e000, 4096, PROT_READ) = 0
07:48:21.522415 mprotect(0x7fc07fd2d000, 4096, PROT_READ) = 0
07:48:21.522841 mprotect(0x7fc07feff000, 45056, PROT_READ) = 0
07:48:21.522908 mprotect(0x7fc080187000, 4096, PROT_READ) = 0
07:48:21.522974 mprotect(0x7fc080177000, 4096, PROT_READ) = 0
07:48:21.523072 mprotect(0x663000, 12288, PROT_READ) = 0
07:48:21.523106 mprotect(0x7fc0801ca000, 4096, PROT_READ) = 0
07:48:21.523160 munmap(0x7fc08018b000, 72511) = 0
07:48:21.523241 set_tid_address(0x7fc07f9aba10) = 86808
07:48:21.523314 set_robust_list(0x7fc07f9aba20, 24) = 0
07:48:21.523384 rt_sigaction(SIGRTMIN, {sa_handler=0x7fc07fcf8bf0, sa_mask=[], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x7fc07fd063c0}, NULL, 8) = 0
07:48:21.523471 rt_sigaction(SIGRT_1, {sa_handler=0x7fc07fcf8c90, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART|SA_SIGINFO, sa_restorer=0x7fc07fd063c0}, NULL, 8) = 0
07:48:21.523547 rt_sigprocmask(SIG_UNBLOCK, [RTMIN RT_1], NULL, 8) = 0
07:48:21.523644 prlimit64(0, RLIMIT_STACK, NULL, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0
07:48:21.523964 brk(NULL)               = 0x1b23000
07:48:21.524100 brk(0x1b44000)          = 0x1b44000
07:48:21.524322 rt_sigaction(SIGHUP, {sa_handler=0x420c10, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7fc07fd063c0}, NULL, 8) = 0
07:48:21.524469 rt_sigaction(SIGQUIT, {sa_handler=0x420c10, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7fc07fd063c0}, NULL, 8) = 0
07:48:21.524722 rt_sigaction(SIGABRT, {sa_handler=0x420c10, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7fc07fd063c0}, NULL, 8) = 0
07:48:21.524918 rt_sigaction(SIGTERM, {sa_handler=0x420c10, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7fc07fd063c0}, NULL, 8) = 0
07:48:21.525064 rt_sigaction(SIGINT, {sa_handler=0x420c10, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7fc07fd063c0}, NULL, 8) = 0
07:48:21.525186 readlink("/proc/self/exe", "/opt/mssql-tools/bin/sqlcmd", 4095) = 27
07:48:21.525377 futex(0x7fc07ff0d6bc, FUTEX_WAKE_PRIVATE, 2147483647) = 0
07:48:21.525671 futex(0x7fc07ff0d6c8, FUTEX_WAKE_PRIVATE, 2147483647) = 0
07:48:21.525838 openat(AT_FDCWD, "/opt/mssql-tools/bin/../share/resources/en_US/SQLCMD.rll", O_RDONLY) = 3
07:48:21.526029 read(3, "MZ22034377377270@"..., 8191) = 8191
07:48:21.526203 lseek(3, 0, SEEK_END)   = 24576
07:48:21.526337 lseek(3, 0, SEEK_CUR)   = 24576
07:48:21.526441 lseek(3, 0, SEEK_SET)   = 0
07:48:21.526609 read(3, "MZ22034377377270@"..., 24576) = 24576
07:48:21.526761 close(3)                = 0
07:48:21.526937 geteuid()               = 1000
07:48:21.527080 socket(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 3
07:48:21.527209 connect(3, {sa_family=AF_UNIX, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
07:48:21.527360 close(3)                = 0
07:48:21.527480 socket(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 3
07:48:21.527721 connect(3, {sa_family=AF_UNIX, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
07:48:21.527854 close(3)                = 0
07:48:21.527980 openat(AT_FDCWD, "/etc/nsswitch.conf", O_RDONLY|O_CLOEXEC) = 3
07:48:21.528098 fstat(3, {st_mode=S_IFREG|0644, st_size=542, ...}) = 0
07:48:21.528228 read(3, "# /etc/nsswitch.confn#n# Example"..., 4096) = 542
07:48:21.528384 read(3, "", 4096)       = 0
07:48:21.528520 close(3)                = 0
07:48:21.528650 openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
07:48:21.528836 fstat(3, {st_mode=S_IFREG|0644, st_size=72511, ...}) = 0
07:48:21.528953 mmap(NULL, 72511, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fc08018b000
07:48:21.529075 close(3)                = 0
07:48:21.529180 openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libnss_files.so.2", O_RDONLY|O_CLOEXEC) = 3
07:48:21.529287 read(3, "177ELF2113>13005"..., 832) = 832
07:48:21.529408 fstat(3, {st_mode=S_IFREG|0644, st_size=51832, ...}) = 0
07:48:21.529543 mmap(NULL, 79672, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fc07f997000
07:48:21.529664 mmap(0x7fc07f99a000, 28672, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x3000) = 0x7fc07f99a000
07:48:21.529768 mmap(0x7fc07f9a1000, 8192, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xa000) = 0x7fc07f9a1000
07:48:21.529872 mmap(0x7fc07f9a3000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xb000) = 0x7fc07f9a3000
07:48:21.529982 mmap(0x7fc07f9a5000, 22328, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fc07f9a5000
07:48:21.530122 close(3)                = 0
07:48:21.530230 mprotect(0x7fc07f9a3000, 4096, PROT_READ) = 0
07:48:21.530339 munmap(0x7fc08018b000, 72511) = 0
07:48:21.530443 openat(AT_FDCWD, "/etc/passwd", O_RDONLY|O_CLOEXEC) = 3
07:48:21.530552 lseek(3, 0, SEEK_CUR)   = 0
07:48:21.530625 fstat(3, {st_mode=S_IFREG|0644, st_size=3112, ...}) = 0
07:48:21.530704 read(3, "root:x:0:0:root:/root:/bin/bashn"..., 4096) = 3112
07:48:21.530783 close(3)                = 0
07:48:21.530852 uname({sysname="Linux", nodename="center", ...}) = 0
07:48:21.530928 openat(AT_FDCWD, "/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3
07:48:21.531013 fstat(3, {st_mode=S_IFREG|0644, st_size=5699248, ...}) = 0
07:48:21.531086 mmap(NULL, 5699248, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fc07f427000
07:48:21.531157 close(3)                = 0
07:48:21.531256 brk(0x1b65000)          = 0x1b65000
07:48:21.531327 openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/gconv/gconv-modules.cache", O_RDONLY) = 3
07:48:21.531416 fstat(3, {st_mode=S_IFREG|0644, st_size=27002, ...}) = 0
07:48:21.531666 mmap(NULL, 27002, PROT_READ, MAP_SHARED, 3, 0) = 0x7fc080196000
07:48:21.531826 close(3)                = 0
07:48:21.531966 futex(0x7fc07fcec634, FUTEX_WAKE_PRIVATE, 2147483647) = 0
07:48:21.532142 brk(0x1b87000)          = 0x1b87000
07:48:21.532249 fstat(0, {st_mode=S_IFCHR|0620, st_rdev=makedev(0x88, 0), ...}) = 0
07:48:21.532418 brk(0x1ba8000)          = 0x1ba8000
07:48:21.532612 readlink("/proc/self/exe", "/opt/mssql-tools/bin/sqlcmd", 4095) = 27
07:48:21.532731 openat(AT_FDCWD, "/opt/mssql-tools/bin/../share/resources/en_US/BatchParserGrammar.dfa", O_RDONLY) = 3
07:48:21.532870 fstat(3, {st_mode=S_IFREG|0644, st_size=48088, ...}) = 0
07:48:21.533003 fstat(3, {st_mode=S_IFREG|0644, st_size=48088, ...}) = 0
07:48:21.533120 lseek(3, 45056, SEEK_SET) = 45056
07:48:21.533260 read(3, "6--17000917A"..., 3032) = 3032
07:48:21.533444 lseek(3, 0, SEEK_SET)   = 0
07:48:21.533570 read(3, "26XLSS"..., 45056) = 45056
07:48:21.533730 read(3, "6--17000917A"..., 4096) = 3032
07:48:21.533848 close(3)                = 0
07:48:21.533983 readlink("/proc/self/exe", "/opt/mssql-tools/bin/sqlcmd", 4095) = 27
07:48:21.534199 openat(AT_FDCWD, "/opt/mssql-tools/bin/../share/resources/en_US/BatchParserGrammar.llr", O_RDONLY) = 3
07:48:21.534316 fstat(3, {st_mode=S_IFREG|0644, st_size=10196, ...}) = 0
07:48:21.536565 fstat(3, {st_mode=S_IFREG|0644, st_size=10196, ...}) = 0
07:48:21.536761 lseek(3, 8192, SEEK_SET) = 8192
07:48:21.536909 read(3, "625 G25 H25 R25 "..., 2004) = 2004
07:48:21.537043 lseek(3, 0, SEEK_SET)   = 0
07:48:21.537160 read(3, "CYSS\201370430237042745 7"..., 8192) = 8192
07:48:21.537327 read(3, "625 G25 H25 R25 "..., 4096) = 2004
07:48:21.537476 close(3)                = 0
07:48:21.537606 openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/gconv/UTF-16.so", O_RDONLY|O_CLOEXEC) = 3
07:48:21.537748 read(3, "177ELF2113>1 21"..., 832) = 832
07:48:21.537881 fstat(3, {st_mode=S_IFREG|0644, st_size=18688, ...}) = 0
07:48:21.538019 mmap(NULL, 20576, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fc080190000
07:48:21.538167 mmap(0x7fc080191000, 8192, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1000) = 0x7fc080191000
07:48:21.538300 mmap(0x7fc080193000, 4096, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x3000) = 0x7fc080193000
07:48:21.538427 mmap(0x7fc080194000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x3000) = 0x7fc080194000
07:48:21.538533 close(3)                = 0
07:48:21.538636 mprotect(0x7fc080194000, 4096, PROT_READ) = 0
07:48:21.538787 openat(AT_FDCWD, "/etc/odbcinst.ini", O_RDONLY) = 3
07:48:21.538888 fstat(3, {st_mode=S_IFREG|0644, st_size=163, ...}) = 0
07:48:21.538992 read(3, "[ODBC Driver 17 for SQL Server]n"..., 4096) = 163
07:48:21.539095 read(3, "", 4096)       = 0
07:48:21.539196 close(3)                = 0
07:48:21.539375 openat(AT_FDCWD, "/home/vagrant/.odbcinst.ini", O_RDONLY) = -1 ENOENT (No such file or directory)
07:48:21.539510 openat(AT_FDCWD, "/etc/odbcinst.ini", O_RDONLY) = 3
07:48:21.539613 fstat(3, {st_mode=S_IFREG|0644, st_size=163, ...}) = 0
07:48:21.539713 read(3, "[ODBC Driver 17 for SQL Server]n"..., 4096) = 163
07:48:21.539816 read(3, "", 4096)       = 0
07:48:21.539883 close(3)                = 0
07:48:21.539947 openat(AT_FDCWD, "/home/vagrant/.odbcinst.ini", O_RDONLY) = -1 ENOENT (No such file or directory)
07:48:21.540036 mmap(NULL, 8392704, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_STACK, -1, 0) = 0x7fc07ec26000
07:48:21.540113 mprotect(0x7fc07ec27000, 8388608, PROT_READ|PROT_WRITE) = 0
07:48:21.540192 clone(child_stack=0x7fc07f425fb0, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, parent_tid=[86809], tls=0x7fc07f426700, child_tidptr=0x7fc07f4269d0) = 86809
07:48:21.540310 futex(0x7ffdd8ed0630, FUTEX_WAIT_PRIVATE, 0, NULL) = 0
07:48:21.696069 futex(0x1b46820, FUTEX_WAKE_PRIVATE, 1) = 0
07:48:21.696293 write(2, "Sqlcmd: Error: Microsoft ODBC Dr"..., 186Sqlcmd: 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.
) = 186
07:48:21.696694 exit_group(1)           = ?
07:48:21.697209 +++ exited with 1 +++

@yitam

@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

@Trymzet

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.

@tjarosz-stdair

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.

@giagara

@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.

select @@version;

Microsoft SQL Server 2014 (SP3-CU4-GDR) (KB4583462) - 12.0.6433.1 (X64)   Oct 31 2020 02:54:45   Copyright (c) Microsoft Corporation  Standard Edition (64-bit) on Windows NT 6.3 <X64> (Build 9600: ) (Hypervisor) 

`sqlcmd -S hostname,12345 -U user -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.

PHP error

SQLSTATE[08001]: [Microsoft][ODBC Driver 17 for SQL Server]TCP Provider: Error code 0x2746 (SQL: select * from test)

lsb_release -a

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.2 LTS
Release:        20.04
Codename:       focal

php --ri sqlsrv

sqlsrv

sqlsrv support => enabled
ExtensionVer => 5.9.0

Directive => Local Value => Master Value
sqlsrv.WarningsReturnAsErrors => On => On
sqlsrv.LogSeverity => 0 => 0
sqlsrv.LogSubsystems => 0 => 0
sqlsrv.ClientBufferMaxKBSize => 10240 => 10240
sqlsrv.SetLocaleInfo => 2 => 2

php --ri pdo_sqlsrv

pdo_sqlsrv

pdo_sqlsrv support => enabled
ExtensionVer => 5.9.0

Directive => Local Value => Master Value
pdo_sqlsrv.log_severity => 0 => 0
pdo_sqlsrv.client_buffer_max_kb_size => 10240 => 10240
pdo_sqlsrv.report_additional_errors => 1 => 1
pdo_sqlsrv.set_locale_info => 2 => 2

strace -tt sqlcmd -S database.test,12345 -U username -P 'password'

07:48:21.496550 execve("/opt/mssql-tools/bin/sqlcmd", ["sqlcmd", "-S", "database.test,12345", "-U", "username", "-P", "password"], 0x7ffe53bc7848 /* 26 vars */) = 0
07:48:21.500883 brk(NULL)               = 0x1b23000
07:48:21.500997 arch_prctl(0x3001 /* ARCH_??? */, 0x7ffdd8ed07a0) = -1 EINVAL (Invalid argument)
07:48:21.501208 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
07:48:21.501345 openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
07:48:21.501459 fstat(3, {st_mode=S_IFREG|0644, st_size=72511, ...}) = 0
07:48:21.501570 mmap(NULL, 72511, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fc08018b000
07:48:21.501908 close(3)                = 0
07:48:21.502084 openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libdl.so.2", O_RDONLY|O_CLOEXEC) = 3
07:48:21.502187 read(3, "177ELF2113>1 22"..., 832) = 832
07:48:21.502267 fstat(3, {st_mode=S_IFREG|0644, st_size=18816, ...}) = 0
07:48:21.502339 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fc080189000
07:48:21.502414 mmap(NULL, 20752, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fc080183000
07:48:21.502485 mmap(0x7fc080184000, 8192, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1000) = 0x7fc080184000
07:48:21.502559 mmap(0x7fc080186000, 4096, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x3000) = 0x7fc080186000
07:48:21.502685 mmap(0x7fc080187000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x3000) = 0x7fc080187000
07:48:21.502803 close(3)                = 0
07:48:21.502871 openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libodbc.so.2", O_RDONLY|O_CLOEXEC) = 3
07:48:21.502945 read(3, "177ELF2113>1340q"..., 832) = 832
07:48:21.503017 fstat(3, {st_mode=S_IFREG|0755, st_size=2453791, ...}) = 0
07:48:21.503090 mmap(NULL, 2565912, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fc07ff10000
07:48:21.503163 mprotect(0x7fc07ff78000, 2093056, PROT_NONE) = 0
07:48:21.503235 mmap(0x7fc080177000, 32768, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x67000) = 0x7fc080177000
07:48:21.503308 mmap(0x7fc08017f000, 14104, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fc08017f000
07:48:21.503379 close(3)                = 0
07:48:21.503445 openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libstdc++.so.6", O_RDONLY|O_CLOEXEC) = 3
07:48:21.503517 read(3, "177ELF21133>1240341t"..., 832) = 832
07:48:21.516818 fstat(3, {st_mode=S_IFREG|0644, st_size=1952928, ...}) = 0
07:48:21.516986 mmap(NULL, 1968128, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fc07fd2f000
07:48:21.517081 mprotect(0x7fc07fdc5000, 1286144, PROT_NONE) = 0
07:48:21.517184 mmap(0x7fc07fdc5000, 983040, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x96000) = 0x7fc07fdc5000
07:48:21.517286 mmap(0x7fc07feb5000, 299008, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x186000) = 0x7fc07feb5000
07:48:21.517395 mmap(0x7fc07feff000, 57344, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1cf000) = 0x7fc07feff000
07:48:21.517499 mmap(0x7fc07ff0d000, 10240, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fc07ff0d000
07:48:21.517612 close(3)                = 0
07:48:21.517717 openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libgcc_s.so.1", O_RDONLY|O_CLOEXEC) = 3
07:48:21.517847 read(3, "177ELF2113>13405"..., 832) = 832
07:48:21.517960 fstat(3, {st_mode=S_IFREG|0644, st_size=104984, ...}) = 0
07:48:21.518058 mmap(NULL, 107592, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fc07fd14000
07:48:21.518170 mmap(0x7fc07fd17000, 73728, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x3000) = 0x7fc07fd17000
07:48:21.518270 mmap(0x7fc07fd29000, 16384, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x15000) = 0x7fc07fd2900007:48:21.518370 mmap(0x7fc07fd2d000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x18000) = 0x7fc07fd2d000
07:48:21.518475 close(3)                = 0
07:48:21.518573 openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libpthread.so.0", O_RDONLY|O_CLOEXEC) = 3
07:48:21.518690 read(3, "177ELF2113>1220201"..., 832) = 832
07:48:21.518856 pread64(3, "4243GNU345Ga367265T320374301V)Yf]223337"..., 68, 824) = 68
07:48:21.518962 fstat(3, {st_mode=S_IFREG|0755, st_size=157224, ...}) = 0
07:48:21.519100 pread64(3, "4243GNU345Ga367265T320374301V)Yf]223337"..., 68, 824) = 68
07:48:21.519215 mmap(NULL, 140408, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fc07fcf1000
07:48:21.519355 mmap(0x7fc07fcf8000, 69632, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x7000) = 0x7fc07fcf8000
07:48:21.519491 mmap(0x7fc07fd09000, 20480, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x18000) = 0x7fc07fd0900007:48:21.519583 mmap(0x7fc07fd0e000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1c000) = 0x7fc07fd0e000
07:48:21.519735 mmap(0x7fc07fd10000, 13432, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fc07fd10000
07:48:21.519871 close(3)                = 0
07:48:21.519992 openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
07:48:21.520125 read(3, "177ELF21133>1360q2"..., 832) = 832
07:48:21.520230 pread64(3, "64@@@"..., 784, 64) = 784
07:48:21.520322 pread64(3, "4205GNU230043", 32, 848) = 32
07:48:21.520422 pread64(3, "4243GNUt233222%2742603203133132610204276X>263"..., 68, 880) = 68
07:48:21.520521 fstat(3, {st_mode=S_IFREG|0755, st_size=2029224, ...}) = 0
07:48:21.520625 pread64(3, "64@@@"..., 784, 64) = 784
07:48:21.520727 pread64(3, "4205GNU230043", 32, 848) = 32
07:48:21.520819 pread64(3, "4243GNUt233222%2742603203133132610204276X>263"..., 68, 880) = 68
07:48:21.520923 mmap(NULL, 2036952, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fc07faff000
07:48:21.521008 mprotect(0x7fc07fb24000, 1847296, PROT_NONE) = 0
07:48:21.521095 mmap(0x7fc07fb24000, 1540096, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x25000) = 0x7fc07fb24000
07:48:21.521183 mmap(0x7fc07fc9c000, 303104, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x19d000) = 0x7fc07fc9c000
07:48:21.521265 mmap(0x7fc07fce7000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1e7000) = 0x7fc07fce7000
07:48:21.521339 mmap(0x7fc07fced000, 13528, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fc07fced000
07:48:21.521435 close(3)                = 0
07:48:21.521509 openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libm.so.6", O_RDONLY|O_CLOEXEC) = 3
07:48:21.521577 read(3, "177ELF21133>1300363"..., 832) = 832
07:48:21.521664 fstat(3, {st_mode=S_IFREG|0644, st_size=1369352, ...}) = 0
07:48:21.521734 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fc07fafd000
07:48:21.521812 mmap(NULL, 1368336, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fc07f9ae000
07:48:21.521864 mmap(0x7fc07f9bd000, 684032, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xf000) = 0x7fc07f9bd000
07:48:21.521919 mmap(0x7fc07fa64000, 618496, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xb6000) = 0x7fc07fa64000
07:48:21.521973 mmap(0x7fc07fafb000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x14c000) = 0x7fc07fafb000
07:48:21.522029 close(3)                = 0
07:48:21.522095 mmap(NULL, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fc07f9ab000
07:48:21.522158 arch_prctl(ARCH_SET_FS, 0x7fc07f9ab740) = 0
07:48:21.522248 mprotect(0x7fc07fce7000, 12288, PROT_READ) = 0
07:48:21.522312 mprotect(0x7fc07fafb000, 4096, PROT_READ) = 0
07:48:21.522364 mprotect(0x7fc07fd0e000, 4096, PROT_READ) = 0
07:48:21.522415 mprotect(0x7fc07fd2d000, 4096, PROT_READ) = 0
07:48:21.522841 mprotect(0x7fc07feff000, 45056, PROT_READ) = 0
07:48:21.522908 mprotect(0x7fc080187000, 4096, PROT_READ) = 0
07:48:21.522974 mprotect(0x7fc080177000, 4096, PROT_READ) = 0
07:48:21.523072 mprotect(0x663000, 12288, PROT_READ) = 0
07:48:21.523106 mprotect(0x7fc0801ca000, 4096, PROT_READ) = 0
07:48:21.523160 munmap(0x7fc08018b000, 72511) = 0
07:48:21.523241 set_tid_address(0x7fc07f9aba10) = 86808
07:48:21.523314 set_robust_list(0x7fc07f9aba20, 24) = 0
07:48:21.523384 rt_sigaction(SIGRTMIN, {sa_handler=0x7fc07fcf8bf0, sa_mask=[], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x7fc07fd063c0}, NULL, 8) = 0
07:48:21.523471 rt_sigaction(SIGRT_1, {sa_handler=0x7fc07fcf8c90, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART|SA_SIGINFO, sa_restorer=0x7fc07fd063c0}, NULL, 8) = 0
07:48:21.523547 rt_sigprocmask(SIG_UNBLOCK, [RTMIN RT_1], NULL, 8) = 0
07:48:21.523644 prlimit64(0, RLIMIT_STACK, NULL, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0
07:48:21.523964 brk(NULL)               = 0x1b23000
07:48:21.524100 brk(0x1b44000)          = 0x1b44000
07:48:21.524322 rt_sigaction(SIGHUP, {sa_handler=0x420c10, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7fc07fd063c0}, NULL, 8) = 0
07:48:21.524469 rt_sigaction(SIGQUIT, {sa_handler=0x420c10, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7fc07fd063c0}, NULL, 8) = 0
07:48:21.524722 rt_sigaction(SIGABRT, {sa_handler=0x420c10, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7fc07fd063c0}, NULL, 8) = 0
07:48:21.524918 rt_sigaction(SIGTERM, {sa_handler=0x420c10, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7fc07fd063c0}, NULL, 8) = 0
07:48:21.525064 rt_sigaction(SIGINT, {sa_handler=0x420c10, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7fc07fd063c0}, NULL, 8) = 0
07:48:21.525186 readlink("/proc/self/exe", "/opt/mssql-tools/bin/sqlcmd", 4095) = 27
07:48:21.525377 futex(0x7fc07ff0d6bc, FUTEX_WAKE_PRIVATE, 2147483647) = 0
07:48:21.525671 futex(0x7fc07ff0d6c8, FUTEX_WAKE_PRIVATE, 2147483647) = 0
07:48:21.525838 openat(AT_FDCWD, "/opt/mssql-tools/bin/../share/resources/en_US/SQLCMD.rll", O_RDONLY) = 3
07:48:21.526029 read(3, "MZ22034377377270@"..., 8191) = 8191
07:48:21.526203 lseek(3, 0, SEEK_END)   = 24576
07:48:21.526337 lseek(3, 0, SEEK_CUR)   = 24576
07:48:21.526441 lseek(3, 0, SEEK_SET)   = 0
07:48:21.526609 read(3, "MZ22034377377270@"..., 24576) = 24576
07:48:21.526761 close(3)                = 0
07:48:21.526937 geteuid()               = 1000
07:48:21.527080 socket(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 3
07:48:21.527209 connect(3, {sa_family=AF_UNIX, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
07:48:21.527360 close(3)                = 0
07:48:21.527480 socket(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 3
07:48:21.527721 connect(3, {sa_family=AF_UNIX, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
07:48:21.527854 close(3)                = 0
07:48:21.527980 openat(AT_FDCWD, "/etc/nsswitch.conf", O_RDONLY|O_CLOEXEC) = 3
07:48:21.528098 fstat(3, {st_mode=S_IFREG|0644, st_size=542, ...}) = 0
07:48:21.528228 read(3, "# /etc/nsswitch.confn#n# Example"..., 4096) = 542
07:48:21.528384 read(3, "", 4096)       = 0
07:48:21.528520 close(3)                = 0
07:48:21.528650 openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
07:48:21.528836 fstat(3, {st_mode=S_IFREG|0644, st_size=72511, ...}) = 0
07:48:21.528953 mmap(NULL, 72511, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fc08018b000
07:48:21.529075 close(3)                = 0
07:48:21.529180 openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libnss_files.so.2", O_RDONLY|O_CLOEXEC) = 3
07:48:21.529287 read(3, "177ELF2113>13005"..., 832) = 832
07:48:21.529408 fstat(3, {st_mode=S_IFREG|0644, st_size=51832, ...}) = 0
07:48:21.529543 mmap(NULL, 79672, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fc07f997000
07:48:21.529664 mmap(0x7fc07f99a000, 28672, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x3000) = 0x7fc07f99a000
07:48:21.529768 mmap(0x7fc07f9a1000, 8192, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xa000) = 0x7fc07f9a1000
07:48:21.529872 mmap(0x7fc07f9a3000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xb000) = 0x7fc07f9a3000
07:48:21.529982 mmap(0x7fc07f9a5000, 22328, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fc07f9a5000
07:48:21.530122 close(3)                = 0
07:48:21.530230 mprotect(0x7fc07f9a3000, 4096, PROT_READ) = 0
07:48:21.530339 munmap(0x7fc08018b000, 72511) = 0
07:48:21.530443 openat(AT_FDCWD, "/etc/passwd", O_RDONLY|O_CLOEXEC) = 3
07:48:21.530552 lseek(3, 0, SEEK_CUR)   = 0
07:48:21.530625 fstat(3, {st_mode=S_IFREG|0644, st_size=3112, ...}) = 0
07:48:21.530704 read(3, "root:x:0:0:root:/root:/bin/bashn"..., 4096) = 3112
07:48:21.530783 close(3)                = 0
07:48:21.530852 uname({sysname="Linux", nodename="center", ...}) = 0
07:48:21.530928 openat(AT_FDCWD, "/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3
07:48:21.531013 fstat(3, {st_mode=S_IFREG|0644, st_size=5699248, ...}) = 0
07:48:21.531086 mmap(NULL, 5699248, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fc07f427000
07:48:21.531157 close(3)                = 0
07:48:21.531256 brk(0x1b65000)          = 0x1b65000
07:48:21.531327 openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/gconv/gconv-modules.cache", O_RDONLY) = 3
07:48:21.531416 fstat(3, {st_mode=S_IFREG|0644, st_size=27002, ...}) = 0
07:48:21.531666 mmap(NULL, 27002, PROT_READ, MAP_SHARED, 3, 0) = 0x7fc080196000
07:48:21.531826 close(3)                = 0
07:48:21.531966 futex(0x7fc07fcec634, FUTEX_WAKE_PRIVATE, 2147483647) = 0
07:48:21.532142 brk(0x1b87000)          = 0x1b87000
07:48:21.532249 fstat(0, {st_mode=S_IFCHR|0620, st_rdev=makedev(0x88, 0), ...}) = 0
07:48:21.532418 brk(0x1ba8000)          = 0x1ba8000
07:48:21.532612 readlink("/proc/self/exe", "/opt/mssql-tools/bin/sqlcmd", 4095) = 27
07:48:21.532731 openat(AT_FDCWD, "/opt/mssql-tools/bin/../share/resources/en_US/BatchParserGrammar.dfa", O_RDONLY) = 3
07:48:21.532870 fstat(3, {st_mode=S_IFREG|0644, st_size=48088, ...}) = 0
07:48:21.533003 fstat(3, {st_mode=S_IFREG|0644, st_size=48088, ...}) = 0
07:48:21.533120 lseek(3, 45056, SEEK_SET) = 45056
07:48:21.533260 read(3, "6--17000917A"..., 3032) = 3032
07:48:21.533444 lseek(3, 0, SEEK_SET)   = 0
07:48:21.533570 read(3, "26XLSS"..., 45056) = 45056
07:48:21.533730 read(3, "6--17000917A"..., 4096) = 3032
07:48:21.533848 close(3)                = 0
07:48:21.533983 readlink("/proc/self/exe", "/opt/mssql-tools/bin/sqlcmd", 4095) = 27
07:48:21.534199 openat(AT_FDCWD, "/opt/mssql-tools/bin/../share/resources/en_US/BatchParserGrammar.llr", O_RDONLY) = 3
07:48:21.534316 fstat(3, {st_mode=S_IFREG|0644, st_size=10196, ...}) = 0
07:48:21.536565 fstat(3, {st_mode=S_IFREG|0644, st_size=10196, ...}) = 0
07:48:21.536761 lseek(3, 8192, SEEK_SET) = 8192
07:48:21.536909 read(3, "625 G25 H25 R25 "..., 2004) = 2004
07:48:21.537043 lseek(3, 0, SEEK_SET)   = 0
07:48:21.537160 read(3, "CYSS\201370430237042745 7"..., 8192) = 8192
07:48:21.537327 read(3, "625 G25 H25 R25 "..., 4096) = 2004
07:48:21.537476 close(3)                = 0
07:48:21.537606 openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/gconv/UTF-16.so", O_RDONLY|O_CLOEXEC) = 3
07:48:21.537748 read(3, "177ELF2113>1 21"..., 832) = 832
07:48:21.537881 fstat(3, {st_mode=S_IFREG|0644, st_size=18688, ...}) = 0
07:48:21.538019 mmap(NULL, 20576, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fc080190000
07:48:21.538167 mmap(0x7fc080191000, 8192, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1000) = 0x7fc080191000
07:48:21.538300 mmap(0x7fc080193000, 4096, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x3000) = 0x7fc080193000
07:48:21.538427 mmap(0x7fc080194000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x3000) = 0x7fc080194000
07:48:21.538533 close(3)                = 0
07:48:21.538636 mprotect(0x7fc080194000, 4096, PROT_READ) = 0
07:48:21.538787 openat(AT_FDCWD, "/etc/odbcinst.ini", O_RDONLY) = 3
07:48:21.538888 fstat(3, {st_mode=S_IFREG|0644, st_size=163, ...}) = 0
07:48:21.538992 read(3, "[ODBC Driver 17 for SQL Server]n"..., 4096) = 163
07:48:21.539095 read(3, "", 4096)       = 0
07:48:21.539196 close(3)                = 0
07:48:21.539375 openat(AT_FDCWD, "/home/vagrant/.odbcinst.ini", O_RDONLY) = -1 ENOENT (No such file or directory)
07:48:21.539510 openat(AT_FDCWD, "/etc/odbcinst.ini", O_RDONLY) = 3
07:48:21.539613 fstat(3, {st_mode=S_IFREG|0644, st_size=163, ...}) = 0
07:48:21.539713 read(3, "[ODBC Driver 17 for SQL Server]n"..., 4096) = 163
07:48:21.539816 read(3, "", 4096)       = 0
07:48:21.539883 close(3)                = 0
07:48:21.539947 openat(AT_FDCWD, "/home/vagrant/.odbcinst.ini", O_RDONLY) = -1 ENOENT (No such file or directory)
07:48:21.540036 mmap(NULL, 8392704, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_STACK, -1, 0) = 0x7fc07ec26000
07:48:21.540113 mprotect(0x7fc07ec27000, 8388608, PROT_READ|PROT_WRITE) = 0
07:48:21.540192 clone(child_stack=0x7fc07f425fb0, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, parent_tid=[86809], tls=0x7fc07f426700, child_tidptr=0x7fc07f4269d0) = 86809
07:48:21.540310 futex(0x7ffdd8ed0630, FUTEX_WAIT_PRIVATE, 0, NULL) = 0
07:48:21.696069 futex(0x1b46820, FUTEX_WAKE_PRIVATE, 1) = 0
07:48:21.696293 write(2, "Sqlcmd: Error: Microsoft ODBC Dr"..., 186Sqlcmd: 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.
) = 186
07:48:21.696694 exit_group(1)           = ?
07:48:21.697209 +++ exited with 1 +++

did you solve?

SQL Server 2017 Enterprise on Linux SQL Server 2017 Enterprise Core on Linux SQL Server 2017 Standard on Linux SQL Server 2017 Developer Linux More…Less

Symptoms

When you try to connect SQL Server 2017 for
Linux on a distribution that has OpenSSL 1.1 configured and OpenSSL 1.0 is not installed, you may receive a connection error message that resembles the following:

A connection was successfully established
with the server, but then an error occurred during the login process.
(provider: SSL Provider, error:0 — An existing connection was forcibly closed
by the remote host.)

For example: When you try to connect with
SQLCMD, you may receive the following error messages:

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. 

Note: An example of Linux distribution which
comes with OpenSSL 1.1 and without OpenSSL 1.0 installed is Red Hat Enterprise
Linux 8.0.

Status

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the «Applies to» section.

Resolution

This issue is fixed in the following cumulative update for SQL Server:

  • Cumulative Update 18 for SQL Server 2017

About cumulative updates for SQL Server:

Each new cumulative update for SQL Server contains all the hotfixes and all the security fixes that were included with the previous cumulative update. Check out the latest cumulative updates for SQL Server:

  • Latest cumulative update for SQL Server 2017

References

Learn about the terminology that Microsoft uses to describe software updates.

Need more help?

Содержание

  1. KB5003342 — FIX: SQL Server Express LocalDB can’t start or connect to shared instances of SQL Server Express LocalDB 2019 or 2017
  2. Symptoms
  3. Resolution
  4. Status
  5. More information
  6. References
  7. Sqlcmd error microsoft odbc driver
  8. Answered by:
  9. Question
  10. Answers
  11. All replies
  12. KB4548001 — FIX: Connection error occurs when you try to connect SQL Server 2017 on Linux by using OpenSSL 1.1
  13. Symptoms
  14. Status
  15. Resolution
  16. References
  17. Sqlcmd error microsoft odbc driver
  18. Answered by:
  19. Question
  20. Answers
  21. KB4548001 — FIX: Connection error occurs when you try to connect SQL Server 2017 on Linux by using OpenSSL 1.1
  22. Symptoms
  23. Status
  24. Resolution
  25. References

KB5003342 — FIX: SQL Server Express LocalDB can’t start or connect to shared instances of SQL Server Express LocalDB 2019 or 2017

Symptoms

Assume that you use the SqlLocalDB feature in Microsoft SQL Server 2019 or 2017. In this situation, you can’t start correctly or connect to a shared instance of SqlLocalDB.

Resolution

This problem is fixed in the following cumulative updates for SQL Server:

Each new cumulative update for SQL Server contains all the hotfixes and security fixes that were in the previous build. We recommend that you install the latest build for your version of SQL Server:

Status

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the «Applies to» section.

More information

This issue occurs when you try to connect to a shared instance of LocalDB.

REM Create named instance FOO

SqlLocalDB.exe create FOO

REM Run the following command from an elevated command prompt

REM Share instance FOO as FOOSHARED

SqlLocalDB.exe share FOO FOOSHARED

When you run the following command, you may receive an error message as shown below:

SqlCmd.exe -S (localdb).FOOSHARED -E

Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : Named Pipes Provider: Could not open a connection to SQL Server [2]. .

Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : Login timeout expired.

Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online..

References

Learn about the terminology that Microsoft uses to describe software updates.

Источник

Sqlcmd error microsoft odbc driver

This forum has migrated to Microsoft Q&A. Visit Microsoft Q&A to post new questions.

Answered by:

Question

I tried run SQLCMD from the command line:

sqlcmd -E -S MSSQLSERVER

Answers

Is SQL Server running local on the machine? The replace MSSQLSERVER with a dot (if it’s a Default instance)

Optional you can use the Parameter -L (large L) to list local instances

If you connecting remote server then

server property —>connection —>remote connection-> should enabled Allow remote connection.

sqlcmd -S Servername -U username -P password

Please click Mark As Answer if my post helped.

Is SQL Server running local on the machine? The replace MSSQLSERVER with a dot (if it’s a Default instance)

Optional you can use the Parameter -L (large L) to list local instances

If you connecting remote server then

server property —>connection —>remote connection-> should enabled Allow remote connection.

sqlcmd -S Servername -U username -P password

Please click Mark As Answer if my post helped.

Might be just my instance but I finally solved it by switching to a quoted instance reference;

From: sqlcmd — E — S localhost

To: sqlcmd — E — S » «

Or in Management Studio dynamically grabbing the current instance,

DECLARE @Cmd VARCHAR(1024)

SET @Cmd = ‘sqlcmd -E -S «‘ + @@SERVERNAME + ‘»

Источник

KB4548001 — FIX: Connection error occurs when you try to connect SQL Server 2017 on Linux by using OpenSSL 1.1

Symptoms

When you try to connect SQL Server 2017 for Linux on a distribution that has OpenSSL 1.1 configured and OpenSSL 1.0 is not installed, you may receive a connection error message that resembles the following:

A connection was successfully established with the server, but then an error occurred during the login process. (provider: SSL Provider, error:0 — An existing connection was forcibly closed by the remote host.)

For example: When you try to connect with SQLCMD, you may receive the following error messages:

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.

Note: An example of Linux distribution which comes with OpenSSL 1.1 and without OpenSSL 1.0 installed is Red Hat Enterprise Linux 8.0.

Status

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the «Applies to» section.

Resolution

This issue is fixed in the following cumulative update for SQL Server:

About cumulative updates for SQL Server:

Each new cumulative update for SQL Server contains all the hotfixes and all the security fixes that were included with the previous cumulative update. Check out the latest cumulative updates for SQL Server:

References

Learn about the terminology that Microsoft uses to describe software updates.

Источник

Sqlcmd error microsoft odbc driver

This forum has migrated to Microsoft Q&A. Visit Microsoft Q&A to post new questions.

Answered by:

Question

I just installed SQL Server Express 2017. I am trying to use ‘sqlcmd’ to connect to the instance. Here is what I have tried:

C:Windowssystem32>sqlcmd -S .SQLEXPRESS
Sqlcmd: Error: Microsoft ODBC Driver 13 for SQL Server : Login failed for user ‘
testtest’..

C:Windowssystem32>sqlcmd -S .SQLEXPRESS -U sa
Password: Sqlcmd: Error: Microsoft ODBC Driver 13 for SQL Server : Login failed
for user ‘sa’..

C:Windowssystem32>sqlcmd -S .SQLEXPRESS -U sa
Password: Sqlcmd: Error: Microsoft ODBC Driver 13 for SQL Server : Login failed

Any idea why this isn’t working? Do I have to use a specific user or password. I am logged into the same user in Windows that I installed SQL Server Express on.

Sorry, I don’t know much about this, just trying to get the installation up and running and confirm that I can access the instance. Thanks.

Answers

When you installed SQL Server, you should have been asked to specify a Windows account to be the admin account. There is a button to add current user. But if you are now logged into Windows with a different account from what you specified at install time, you can not log into SQL Server with that Windows user, with less than you created login for it in SQL Server.

If you try to log in as sa, you need to specify the same password as you specified when you installed SQL Server. Provided that you selected SQL authentication at all — by default you only get Windows authentication.

In the SQL Server errorlog you can find more detailed information about the login failures. The error log is in C:program filesmicrosoft sql servermssql14.sqlexpressmssqllogerrorlog

Источник

KB4548001 — FIX: Connection error occurs when you try to connect SQL Server 2017 on Linux by using OpenSSL 1.1

Symptoms

When you try to connect SQL Server 2017 for Linux on a distribution that has OpenSSL 1.1 configured and OpenSSL 1.0 is not installed, you may receive a connection error message that resembles the following:

A connection was successfully established with the server, but then an error occurred during the login process. (provider: SSL Provider, error:0 — An existing connection was forcibly closed by the remote host.)

For example: When you try to connect with SQLCMD, you may receive the following error messages:

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.

Note: An example of Linux distribution which comes with OpenSSL 1.1 and without OpenSSL 1.0 installed is Red Hat Enterprise Linux 8.0.

Status

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the «Applies to» section.

Resolution

This issue is fixed in the following cumulative update for SQL Server:

About cumulative updates for SQL Server:

Each new cumulative update for SQL Server contains all the hotfixes and all the security fixes that were included with the previous cumulative update. Check out the latest cumulative updates for SQL Server:

References

Learn about the terminology that Microsoft uses to describe software updates.

Источник

Tcp provider error code 0x2746 10054 sqldriverconnect

This forum has migrated to Microsoft Q&A. Visit Microsoft Q&A to post new questions.

Asked by:

Question

After some upgrades, I’m afraid I didn’t (keep track of which ones) I have become unable to connect to SQL Server from my Linux development box (Ubuntu). I had been doing NodeJS development using the mssql/tedious packages, connecting to both SQL Server running on Linux and Azure. Now I am unable to connect to either server. I am unable to connect using either the node libraries or sqlcmd. Here’s the error I see when using `sqlcmd` connecting to my local database, which is running with no server errors in the logs:

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

What is error code 0x2746? How can I fix this?

Here’s all the versions I think you might ask for:

Distro: Ubuntu 18.04.3 LTS

sqlcmd: Version 17.4.0001.1 Linux

openssl: 1.1.1 11 Sep 2018

Let me know if there are any more details that would help.

Источник

Error: TCP Provider: Error code 0x2746. During the Sql setup in linux through terminal

The SQL server status is Active (Running).

I am getting the following error while executing the command

Error:

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.

I also tried by giving the command

But the same error is displayed. When I tried the wrong password it also displays the same error.

19 Answers 19

[UPDATE 17.03.2020: Microsoft has released SQL Server 2019 CU3 with an Ubuntu 18.04 repository. See: https://techcommunity.microsoft.com/t5/sql-server/sql-server-2019-now-available-on-ubuntu-18-04-supported-on-sles/ba-p/1232210 . I hope this is now fully compatible without any ssl problems. Haven’t tested it jet.]

Reverting to 14.0.3192.2-2 helps.

But it’s possible to solve the problem also using the method indicated by Ola774, not only in case of upgrade from Ubuntu 16.04 to 18.04, but on every installation of SQL Server 2017 on Ubuntu 18.04.

It seems that Microsoft now in cu16 messed up with their own patch for the ssl-version problems applied in cu10 (https://techcommunity.microsoft.com/t5/SQL-Server/Installing-SQL-Server-2017-for-Linux-on-Ubuntu-18-04-LTS/ba-p/385983). But linking the ssl 1.0.0 libraries works.

So just do the following:

Stop SQL Server

Open the editor for the service configuration by

This will create an override for the original service config. It’s correct that the override-file, or, more exactly «drop-in-file», is empty when used the first time.

In the editor, add the following lines to the file and save it:

Create symbolic links to OpenSSL 1.0 for SQL Server to use:

Start SQL Server

If you are having issues with the client on Debian 10 with OpenSSL1.1.1 the fix is to revert to the previously default weaker key length. To do so:

Modify /etc/ssl/openssl.cnf config file as follows (fyi see known issues with OpenSSL 1.1.1 in Debian 10 below):

Change the last line from CipherString = DEFAULT@SECLEVEL=2 to CipherString = DEFAULT@SECLEVEL=1

Reverting to this version worked for me.

My scenario was a fresh install (everything latest version) on Ubuntu Server 18.04.2 receiving the client connection error from sqlcmd:

Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : TCP Provider: Error code 0x2746

Simply:

TCP Provider: Error code 0x2746

This is likely a problem with openssl vs. sql-server protocol/version.

Check your openssl version. Run the following command on your terminal openssl version :

If your openssl version is not 1.0, then you may want to solve the connection problem by one of the following options:

Option 1: Workaround your openssl

This command changes your SECLEVEL to 1, if you have it in your /etc/ssl/openssl.cnf file. Done.

Option 2: Downgrade openssl.

If your openssl version is 1.1, you would probably like it to be 1.0. This method is basic: download the source code, configure and make the binary. It may take few minutes to build everything:

Leave comments if you need insights for something special: docker image, or different system, etc.

Upgrade from Ubuntu 16.04 to 18.04 still results in some issues

A few systems may require version 1.0 of the OpenSSL libraries to connect to SQL Server. Using OpenSSL 1.0 can be done as follows:

Stop SQL Server

Open the editor for the service configuration

In the editor, add the following lines to the file and save it:

Create symbolic links to OpenSSL 1.0 for SQL Server to use

Start SQL Server

I hope this helps

You can either roll back to the previous version with the command sudo apt-get install mssql-server=14.0.3192.2-2 or keep the new version by following MSSQL_Ubuntu’s answer.

Also disable the updates on the mssql-server package:

This will not prevent you to update it manually when you wish so.

Same problem. It’s awful because im in dev now and that «great» update just killing my working time.

Update: MS SQL version rollback helped me, but unfortunately I have to remove all my data. Thanks that it was my dev machine. All notes below tested on

1) I’ve remover MS SQL and its data

2) Check available versions of MS SQL in repository

3) Installed custom MS SQL

5) Mem limit, server agent

4) Restart, status

Probably there is some issues with interaction of openssl package and updated MS SQL, I can’t find if it is true or not, but googled a few notes about it. So you can use

To change openssl version and try to connect.

Updated SQL Server to the version 14.0.3223.3-15 (Ubuntu 18.04.2 LTS) today and got exactly the same issue for both local and remote connections. Rolling back to the previous version (14.0.3192.2-2 in my case) worked for me:

sudo apt-get install mssql-server=14.0.3192.2-2

List versions installed on your machine:

apt-cache policy mssql-server

Add these lines:

Then restart the server:

I had the very same issue from within a docker container, I had to downgrade msodbc, mssql-tools and lib ssl:

Now it works like a charm.

Just in case, older versions of ms odbc driver and tools can be found here: https://packages.microsoft.com/debian/9/prod/pool/main/m/

I encountered the same issue with SQL Server 2019 (RTM — 15.0.2000.5) on Debian 10, both trying to connect locally with sqlcmd or remote through SSMS.

The same resolution as mentioned above was able to resolve this for me. My OpenSSL version was 1.0.2, this should be adjusted for whichever version is available.

Now both local and remote connections work OK

At this moment , only this version is working, looks like problem in openssl .

Working on Debian 9 .

Before anything be sure that you have valid backup of DB.

You need to purge mssql-server

apt-get remove —purge mssql-server

and after that check and delete /var/opt/mssql and /opt/mssql .

Next use this version 15.0.1700.37-2

apt-get install mssql-server=15.0.1700.37-2

after config you should be able to connect to mssql server 2019 at localhost or 127.0.0.1

sqlcmd -S localhost -U SA -P ‘YourPassword’

After 2 days working on this problem I’ve finally solved it! In my case, I am using Fedora 28, so for those using RHEL, I followed this tutorial:

So, are you using Python 3? Apparently, you need to switch to Python 2 before installing it, using the following code (I guess in Ubuntu would work as well):

Download it, then install it without resolving dependencies.

After that, you can run the setup for mssql-conf:

And continue the Microsoft documentation tutorial from that step.

Note: I read in some forums that SQL Server 2019 may be causing that problem, so I recommend installing the 2017 version.

I got the same issue.

My OS is Ubuntu 18.10

Then, in my case, I could not enter my SQL server because I got the below message

Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : Login failed for user ‘sa’. Reason: Server is in script upgrade mode. Only administrator can connect at this time..

Each command took a process for a while in my case.

Update 2021, Fedora 34, Sql Server 2019.

If you still have that error you need to execute the following command:

Or check what is actually happening in console by starting the mssql in a single mode:

I don’t recommend down grading openssl any more since you should be able to fix any openssl issue you have by upgrading to a new version. In my case openssl 1.1.1k worked. The easiest way to install an openssl version not in your distro is to install from source. For full details see https://wiki.openssl.org/index.php/Compilation_and_Installation

For me the following steps were sufficient but I assume you will also need build-essentials and a few other packages.

However this will not entirely solve the problem anymore. sqlcmd seems to have a DNS resolution bug that is not in older versions. That means you need the full domain name or ipaddress plus connection protocol or port number may also be required. So while before things like sqlcmd -S 127.0.0.1 or sqlcmd -S worked just fine. Now you may need something like sqlcmd -S tcp:127.0.0.1,

Источник

pyodbc.OperationalError: (‘08001’, ‘[08001] [Microsoft][ODBC Driver 17 for SQL Server]TCP Provider: Error code 0x2746 (10054) (SQLDriverConnect)’) #853

Comments

krushika29 commented Jan 12, 2021

Environment

  • Python: 3.8.5 (64-bit)
  • pyodbc: 4.0.30
  • OS: Ubuntu 20.04.1 LTS
  • DB: SQL Server 13.0.5026.0
  • driver: ODBC Driver 17 for SQL Server

Issue

pyodbc.OperationalError: (‘08001’, ‘[08001] [Microsoft][ODBC Driver 17 for SQL Server]TCP Provider: Error code 0x2746 (10054) (SQLDriverConnect)’)

Additonal Information

Installed ODBC Driver following the steps mentioned here for Ubuntu 20.04 Click Here

Trying to connect to a SQL Server database from a Python web application using Flask.
Here is the python code that connects with the database —

The following is the output for checking pyodbc drivers —
`

import pyodbc
pyodbc.drivers()
[‘ODBC Driver 17 for SQL Server’]

`
I have all the drivers and packages installed correctly, and this is the third time I am installing them and I have the same error. Please help

The text was updated successfully, but these errors were encountered:

krushika29 commented Jan 12, 2021

I have already tried this
Click here

This doesn’t work for me either

v-chojas commented Jan 12, 2021

Can you try to connect with the ODBC driver directly, using isql from the command line?

krushika29 commented Jan 12, 2021

@v-chojas I have implemented the solution mentioned here

After a quick restart of the system, it worked!
Do you know why this issue, is it because I am trying to access an older version of SQL Server database i.e. 2016 from ODBC 17?

v-chojas commented Jan 12, 2021

TLS version mismatch. It is not directly the driver, but the OpenSSL it uses which default to TLS 1.2+ only for the later versions.

cbare commented Sep 14, 2021

Just a note for those that end up here trying to solve a similar issue: I saw the same error from pyodbc.connect running in Windows Subsystem for Linux (5.10.16.3-microsoft-standard-WSL2) / Ubuntu 20.04.3, and OpenSSL 1.1.1k 25 Mar 2021. When connected to VPN I got the error. Error disappeared after disconnecting. The same code and connect string worked over VPN when running from Powershell. I guess some interaction between OpenSSL and our VPN is at play?

v-chojas commented Sep 15, 2021

That sounds more like a routing issue than anything to do with TLS version.

Footer

© 2023 GitHub, Inc.

You can’t perform that action at this time.

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.

Источник

Tcp provider error code 0x2746 10054 sqldriverconnect

This forum has migrated to Microsoft Q&A. Visit Microsoft Q&A to post new questions.

Answered by:

Question

Server: Windows Server 2003 R2
Standard Edition
Service Pack 2
Microsoft SQL Server 2008 R2 (SP3-OD) (KB3144114) — 10.50.6542.0 (Intel X86) Feb 22 2016 18:12:09
Copyright (c) Microsoft Corporation Express Edition on Windows NT 5.2 (Build : ) (Hypervisor)

Client:
SUSE Linux Enterprise Server 12 (x86_64)
VERSION = 12
PATCHLEVEL = 2

ODBC Driver:
/opt/microsoft/msodbcsql/lib64/libmsodbcsql-13.1.so.9.1

Updated from the current repository for SLES12.

Failure from the SQL Trace (a connect attempt using isql):

DIAG [08001] [Microsoft][ODBC Driver 13 for SQL Server]TCP Provider: Error code 0x2746
DIAG [08001] [Microsoft][ODBC Driver 13 for SQL Server]Client unable to establish connection

Is this a problem with TLS 1.2? Is this client/server combination supported ?

Answers

I just solved the same problem,and I should thank you first ,cause I could only find your question had the same error code 0x2746

,and Xi Jin referred to TLS 1.2, I finally found out this problem related to openssl verson.

Server: Windows server 2003 R2

DB version: Sql Server 2005

Oracle linux 7 (x86_64) RHEL 7

openssl version: 1.0.2k-12.el7 and 1.0.1e-12.el7

With version 1.0.2k my client could not establish connection but with 1.0.1e everything works fine。

So I think you might check openssl version first and then try to downgrade it.

I was quite sure this problem had nothing to do with my server as I could connect to it from another client, then I found your question and determinded it had something to do with openssl version, at last I compared those two clients’ openssl verion and found the difference.

Since your question was asked almost one year ago ,I wish you have already solved it.

Источник

Понравилась статья? Поделить с друзьями:
  • Sqlalchemy timeout error
  • Sqlalchemy database error
  • Sql1159 initialization error with db2 net data provider reason code 10
  • Sql сервер ошибка 18456
  • Sql ошибка 924