microsoft / msphpsql

Microsoft Drivers for PHP for SQL Server
MIT License
1.79k stars 371 forks source link

TCP Provider: Error code 0x2746. Client unable to establish connection. #252

Closed Inwerpsel closed 7 years ago

Inwerpsel commented 7 years ago

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 commented 7 years ago

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 commented 7 years ago

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 commented 7 years ago

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 commented 7 years ago

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 commented 7 years ago

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 commented 7 years ago

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:

  1. Run SQL Server on Ubuntu locally (https://www.microsoft.com/en-us/sql-server/sql-server-vnext-including-Linux)
  2. Run SQL Server on a later version of Windows.
  3. Install SQL Server 2008 R2 SP3 and try the article about TLS 1.2 support
srgvg commented 7 years ago

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 commented 7 years ago

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 commented 7 years ago

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

Inwerpsel commented 7 years ago

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 commented 6 years ago

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..
yukiwongky commented 6 years ago

@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 commented 6 years ago

@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 commented 6 years ago

@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 commented 5 years ago

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

david-puglielli commented 5 years ago

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

NaelsonBR commented 5 years ago

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 commented 5 years ago

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/

hrnsky commented 5 years ago

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 commented 5 years ago

@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 commented 5 years ago

@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 commented 5 years ago

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 commented 5 years ago

https://stackoverflow.com/a/57343207/2242402 solved it for me - Need to revert to previous sql server version

sudo apt-get install mssql-server=14.0.3192.2-2
francesco-rossetti commented 5 years ago

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

david-puglielli commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

Figured out By : https://stackoverflow.com/questions/57265913/error-tcp-provider-error-code-0x2746-during-the-sql-setup-in-linux-through-te/57343207#57343207

quqnuss commented 4 years ago

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.

RadBoris commented 4 years ago

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.

brianmsm commented 3 years ago

Same problem here

yitam commented 3 years ago

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

yusrenaltair commented 3 years ago

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 commented 3 years ago

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

plabbett commented 3 years ago

@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, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0 \22\0\0\0\0\0\0"..., 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, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\340q\0\0\0\0\0\0"..., 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, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\240\341\t\0\0\0\0\0"..., 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, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\3405\0\0\0\0\0\0"..., 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, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\220\201\0\0\0\0\0\0"..., 832) = 832
07:48:21.518856 pread64(3, "\4\0\0\0\24\0\0\0\3\0\0\0GNU\0\345Ga\367\265T\320\374\301V)Yf]\223\337"..., 68, 824) = 68
07:48:21.518962 fstat(3, {st_mode=S_IFREG|0755, st_size=157224, ...}) = 0
07:48:21.519100 pread64(3, "\4\0\0\0\24\0\0\0\3\0\0\0GNU\0\345Ga\367\265T\320\374\301V)Yf]\223\337"..., 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, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\360q\2\0\0\0\0\0"..., 832) = 832
07:48:21.520230 pread64(3, "\6\0\0\0\4\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0"..., 784, 64) = 784
07:48:21.520322 pread64(3, "\4\0\0\0\20\0\0\0\5\0\0\0GNU\0\2\0\0\300\4\0\0\0\3\0\0\0\0\0\0\0", 32, 848) = 32
07:48:21.520422 pread64(3, "\4\0\0\0\24\0\0\0\3\0\0\0GNU\0\t\233\222%\274\260\320\31\331\326\10\204\276X>\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, "\6\0\0\0\4\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0"..., 784, 64) = 784
07:48:21.520727 pread64(3, "\4\0\0\0\20\0\0\0\5\0\0\0GNU\0\2\0\0\300\4\0\0\0\3\0\0\0\0\0\0\0", 32, 848) = 32
07:48:21.520819 pread64(3, "\4\0\0\0\24\0\0\0\3\0\0\0GNU\0\t\233\222%\274\260\320\31\331\326\10\204\276X>\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, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\300\363\0\0\0\0\0\0"..., 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, "MZ\220\0\3\0\0\0\4\0\0\0\377\377\0\0\270\0\0\0\0\0\0\0@\0\0\0\0\0\0\0"..., 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, "MZ\220\0\3\0\0\0\4\0\0\0\377\377\0\0\270\0\0\0\0\0\0\0@\0\0\0\0\0\0\0"..., 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.conf\n#\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, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\3005\0\0\0\0\0\0"..., 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/bash\n"..., 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\0\0\0-\0\0\0-\0\0\0\17\0\0\0000\0\0\09\0\0\0\17\0\0\0A\0\0\0"..., 3032) = 3032
07:48:21.533444 lseek(3, 0, SEEK_SET)   = 0
07:48:21.533570 read(3, "\26\0\0\0XLSS\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 45056) = 45056
07:48:21.533730 read(3, "\6\0\0\0-\0\0\0-\0\0\0\17\0\0\0000\0\0\09\0\0\0\17\0\0\0A\0\0\0"..., 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, "\6\0\0\0\25\0\0 G\0\0\0\25\0\0 H\0\0\0\25\0\0 R\0\0\0\25\0\0 "..., 2004) = 2004
07:48:21.537043 lseek(3, 0, SEEK_SET)   = 0
07:48:21.537160 read(3, "CYSS\\\0\0\0\201\0\0\0\370\4\0\0\30\2\0\0\370\4\0\0\274\5\0\0 \7\0\0"..., 8192) = 8192
07:48:21.537327 read(3, "\6\0\0\0\25\0\0 G\0\0\0\25\0\0 H\0\0\0\25\0\0 R\0\0\0\25\0\0 "..., 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, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0 \21\0\0\0\0\0\0"..., 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 commented 3 years ago

@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 commented 2 years ago

For anyone lost in this chain of links, here is the workaround solution: https://github.com/microsoft/msphpsql/issues/1112#issuecomment-609972220. Otherwise, you'll probably have to change the server's TLS version to 1.2.

tjarosz-stdair commented 1 year ago

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 commented 1 year ago

@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, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0 \22\0\0\0\0\0\0"..., 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, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\340q\0\0\0\0\0\0"..., 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, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\240\341\t\0\0\0\0\0"..., 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, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\3405\0\0\0\0\0\0"..., 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, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\220\201\0\0\0\0\0\0"..., 832) = 832
07:48:21.518856 pread64(3, "\4\0\0\0\24\0\0\0\3\0\0\0GNU\0\345Ga\367\265T\320\374\301V)Yf]\223\337"..., 68, 824) = 68
07:48:21.518962 fstat(3, {st_mode=S_IFREG|0755, st_size=157224, ...}) = 0
07:48:21.519100 pread64(3, "\4\0\0\0\24\0\0\0\3\0\0\0GNU\0\345Ga\367\265T\320\374\301V)Yf]\223\337"..., 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, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\360q\2\0\0\0\0\0"..., 832) = 832
07:48:21.520230 pread64(3, "\6\0\0\0\4\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0"..., 784, 64) = 784
07:48:21.520322 pread64(3, "\4\0\0\0\20\0\0\0\5\0\0\0GNU\0\2\0\0\300\4\0\0\0\3\0\0\0\0\0\0\0", 32, 848) = 32
07:48:21.520422 pread64(3, "\4\0\0\0\24\0\0\0\3\0\0\0GNU\0\t\233\222%\274\260\320\31\331\326\10\204\276X>\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, "\6\0\0\0\4\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0"..., 784, 64) = 784
07:48:21.520727 pread64(3, "\4\0\0\0\20\0\0\0\5\0\0\0GNU\0\2\0\0\300\4\0\0\0\3\0\0\0\0\0\0\0", 32, 848) = 32
07:48:21.520819 pread64(3, "\4\0\0\0\24\0\0\0\3\0\0\0GNU\0\t\233\222%\274\260\320\31\331\326\10\204\276X>\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, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\300\363\0\0\0\0\0\0"..., 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, "MZ\220\0\3\0\0\0\4\0\0\0\377\377\0\0\270\0\0\0\0\0\0\0@\0\0\0\0\0\0\0"..., 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, "MZ\220\0\3\0\0\0\4\0\0\0\377\377\0\0\270\0\0\0\0\0\0\0@\0\0\0\0\0\0\0"..., 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.conf\n#\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, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\3005\0\0\0\0\0\0"..., 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/bash\n"..., 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\0\0\0-\0\0\0-\0\0\0\17\0\0\0000\0\0\09\0\0\0\17\0\0\0A\0\0\0"..., 3032) = 3032
07:48:21.533444 lseek(3, 0, SEEK_SET)   = 0
07:48:21.533570 read(3, "\26\0\0\0XLSS\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 45056) = 45056
07:48:21.533730 read(3, "\6\0\0\0-\0\0\0-\0\0\0\17\0\0\0000\0\0\09\0\0\0\17\0\0\0A\0\0\0"..., 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, "\6\0\0\0\25\0\0 G\0\0\0\25\0\0 H\0\0\0\25\0\0 R\0\0\0\25\0\0 "..., 2004) = 2004
07:48:21.537043 lseek(3, 0, SEEK_SET)   = 0
07:48:21.537160 read(3, "CYSS\\\0\0\0\201\0\0\0\370\4\0\0\30\2\0\0\370\4\0\0\274\5\0\0 \7\0\0"..., 8192) = 8192
07:48:21.537327 read(3, "\6\0\0\0\25\0\0 G\0\0\0\25\0\0 H\0\0\0\25\0\0 R\0\0\0\25\0\0 "..., 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, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0 \21\0\0\0\0\0\0"..., 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?

midgard commented 1 year ago

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)

Same error here

YunanJeong commented 1 year ago

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. (https://learn.microsoft.com/sql/linux/sql-server-linux-setup-tools?view=sql-server-ver16&tabs=ubuntu-install%2Credhat-offline)

My Solution is to use docker image. (https://hub.docker.com/_/microsoft-mssql-tools) This is MicroSoft official image, and uses ODBC Driver 13.