Getting "Unexpected EOF from the server" when trying to connect to MS SQL Server 2014
"Pulver, Alex" <[email protected]>
| Newsgroups | gmane.comp.db.tds.freetds |
|---|---|
| Message-ID | <3D59976831C0404BB2EAC2485DB2316E60E12DB9@HASMSX106.ger.corp.intel.com> |
Hi all,
I am trying to connect to MS SQL 2014 Server from SLES11 host, using FreeTDS 0.95.51 version and its tsql utility. The server uses "Standard Mode" (SQL Server Authentication) and I am able to connect from Windows using SQL Server 2014 Management Studio.
Before sending this email I've read through FreeTDS troubleshooting, FAQ, domains page, config page, archives and various SO questions - tried the recommended configurations but with no luck (details below).
The command being run is:
env TDSVER=7.0 TDSDUMP=/tmp/tdsdump.log TDSDUMPCONFIG=/tmp/tdsdumpconfig.log ./src/apps/tsql -H <host> -p <port> -U <username> -P <password> -D <database>
The output:
locale is "C"
locale charset is "ANSI_X3.4-1968"
using default charset "ISO-8859-1"
Setting <database> as default database in login packet
Error 20017 (severity 9):
Unexpected EOF from the server
...
Tailing TDSDUMP along with the execution shows that error is happening after the login packet is sent and FreeTDS tries to process the login tokens:
login.c:852:quietly sending TDS 7+ login packet
token.c:327:tds_process_login_tokens()
<<
Error 20017 (severity 9):
Unexpected EOF from the server
>>
query.c:3772:tds_disconnect()
Looking on strace seems to confirm that server disconnects after login packet is received (poll() returns positive after sendto(), but recvfrom() returns 0):
write(5, "login.c:852:quietly sending TDS "..., 48) = 48
...
poll([{fd=6, events=POLLOUT}, {fd=4, events=POLLIN}], 2, -1) = 1 ([{fd=6, revents=POLLOUT}])
sendto(6, "\20\1\0012\0\0\0\0*\1\0\0\0\0\0p\0\20\0\0\6\203\362\370U\354\0\0\0\0\0\0"..., 306, MSG_NOSIGNAL, NULL, 0) = 306
write(5, "token.c:327:tds_process_login_to"..., 39) = 39
poll([{fd=6, events=POLLIN}, {fd=4, events=POLLIN}], 2, -1) = 1 ([{fd=6, revents=POLLIN}])
recvfrom(6, "", 8, MSG_NOSIGNAL, NULL, NULL) = 0
write(5, "query.c:3772:tds_disconnect() \n", 31) = 31
Things I tried listed in no particular order (assuming the issue is with authentication and not network):
* Use UTF-8 encoding
* Disable SSPI: ./configure --disable-sspi (so that trusted authentication will not be triggered)
* Compile with latest OpenSSL version we have installed: ./configure --with-openssl=/.../openssl/1.0.1/bin/openssl
* Explicitly disable OpenSSL: ./configure --without-openssl
* Modifying the code in ./src/tds/mem.c to disable check_ssl_hostname by setting it to 0 in both places it appears (assuming it triggers checking server's SSL certificate and fails to authenticate). Verified using debugger that *((tds)->login) object has check_ssl_hostname set to 0
* Modifying the code in ./src/tds/tls.c to change location of certificates pointed by ca_directory[] to a directory I know we have updated internal certificates
Things I still need to check with MS SQL Server admins:
* Try to see if they can give me access to server-side log for my connection attempts
* Check if server requires two-way authentication for SQL Server Authentication - doesn't seem like it, but I will check
If someone has any other ideas as to why the connection drops, or other things I can do to investigate further, I would really appreciate that!
Thanks!
Alex
---------------------------------------------------------------------
Intel Israel (74) Limited
This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.