[freetds] tsql having a hard time connecting to a MS SQL server

Ramiro Morales cramm0 at gmail.com
Thu Jun 5 16:35:25 EDT 2014


On Thu, Jun 5, 2014 at 11:12 AM, Mark Lutgen <mlutgen at gmail.com> wrote:
> I'm having an issue on a Red Hat 5 64 bit server but I'm running a nearly
> identical build on a Red Hat 4 32 bit. The error message is much like the
> ones many others have complained about over the years but I've not seen one
> matching this. Please allow me to show you below what happens:
>
> In Bash as root:
>
> export TDSDUMP=/var/log/freetds.log
> export TDSDUMPCONFIG=/var/log/freetds_config.log
>
> then I execute
>
> tsql –S “SQLSERVER\TEST2000” -U readonly -P dbreadonly
>
> It resolves the server name no problem but will not connect. The output is:
>
> locale is "en_US.UTF-8"
> locale charset is "UTF-8"
> using default charset "UTF-8"
> 16There was a problem connecting to the server
>
> /var/log/freetds.log shows this:
>
> log.c:196:Starting log file for FreeTDS 0.91
>         on 2014-06-05 02:41:23 with debug flags 0x4fff.
> iconv.c:330:tds_iconv_open(0x1eaea3b0, UTF-8)
> iconv.c:187:local name for ISO-8859-1 is ISO-8859-1
> iconv.c:187:local name for UTF-8 is UTF-8
> iconv.c:187:local name for UCS-2LE is UCS-2LE
> iconv.c:187:local name for UCS-2BE is UCS-2BE
> iconv.c:349:setting up conversions for client charset "UTF-8"
> iconv.c:351:preparing iconv for "UTF-8" <-> "UCS-2LE" conversion
> iconv.c:391:preparing iconv for "ISO-8859-1" <-> "ISO-8859-1" conversion
> iconv.c:394:tds_iconv_open: done
> net.c:934:tds7_get_instance_port(172.16.50.28, TEST2000)
> net.c:985:tds7_get_instance_port: timed out on try 0 of 16
> net.c:985:tds7_get_instance_port: timed out on try 1 of 16
> net.c:985:tds7_get_instance_port: timed out on try 2 of 16
> net.c:985:tds7_get_instance_port: timed out on try 3 of 16
> net.c:985:tds7_get_instance_port: timed out on try 4 of 16
> net.c:985:tds7_get_instance_port: timed out on try 5 of 16
> net.c:985:tds7_get_instance_port: timed out on try 6 of 16
> net.c:985:tds7_get_instance_port: timed out on try 7 of 16
> net.c:985:tds7_get_instance_port: timed out on try 8 of 16
> net.c:985:tds7_get_instance_port: timed out on try 9 of 16
> net.c:985:tds7_get_instance_port: timed out on try 10 of 16
> net.c:985:tds7_get_instance_port: timed out on try 11 of 16
> net.c:985:tds7_get_instance_port: timed out on try 12 of 16
> net.c:985:tds7_get_instance_port: timed out on try 13 of 16
> net.c:985:tds7_get_instance_port: timed out on try 14 of 16
> net.c:985:tds7_get_instance_port: timed out on try 15 of 16
> net.c:1057:instance port is 0
> login.c:436:invalid port number
> mem.c:615:tds_free_all_results()
>
> On the host running tsql commands, a tcpdump shows this:
>
>
> tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 96
> bytes
> 02:42:33.743293 IP (tos 0x0, ttl  64, id 0, offset 0, flags [DF], proto:
> UDP (17), length: 38) 172.16.45.36.56931 > 172.16.50.28.1434: UDP, length 10
> 02:42:34.740010 IP (tos 0x0, ttl  64, id 0, offset 0, flags [DF], proto:
> UDP (17), length: 38) 172.16.45.36.56931 > 172.16.50.28.1434: UDP, length 10
> 02:42:35.739934 IP (tos 0x0, ttl  64, id 0, offset 0, flags [DF], proto:
> UDP (17), length: 38) 172.16.45.36.56931 > 172.16.50.28.1434: UDP, length 10
> 02:42:36.739969 IP (tos 0x0, ttl  64, id 0, offset 0, flags [DF], proto:
> UDP (17), length: 38) 172.16.45.36.56931 > 172.16.50.28.1434: UDP, length 10
> 02:42:37.740032 IP (tos 0x0, ttl  64, id 0, offset 0, flags [DF], proto:
> UDP (17), length: 38) 172.16.45.36.56931 > 172.16.50.28.1434: UDP, length 10
> 02:42:38.746722 IP (tos 0x0, ttl  64, id 0, offset 0, flags [DF], proto:
> UDP (17), length: 38) 172.16.45.36.56931 > 172.16.50.28.1434: UDP, length 10
> 02:42:39.744165 IP (tos 0x0, ttl  64, id 0, offset 0, flags [DF], proto:
> UDP (17), length: 38) 172.16.45.36.56931 > 172.16.50.28.1434: UDP, length 10
> 02:42:40.744277 IP (tos 0x0, ttl  64, id 0, offset 0, flags [DF], proto:
> UDP (17), length: 38) 172.16.45.36.56931 > 172.16.50.28.1434: UDP, length 10
> 02:42:41.744298 IP (tos 0x0, ttl  64, id 0, offset 0, flags [DF], proto:
> UDP (17), length: 38) 172.16.45.36.56931 > 172.16.50.28.1434: UDP, length 10
> 02:42:42.744369 IP (tos 0x0, ttl  64, id 0, offset 0, flags [DF], proto:
> UDP (17), length: 38) 172.16.45.36.56931 > 172.16.50.28.1434: UDP, length 10
> 02:42:43.744599 IP (tos 0x0, ttl  64, id 0, offset 0, flags [DF], proto:
> UDP (17), length: 38) 172.16.45.36.56931 > 172.16.50.28.1434: UDP, length 10
> 02:42:44.744505 IP (tos 0x0, ttl  64, id 0, offset 0, flags [DF], proto:
> UDP (17), length: 38) 172.16.45.36.56931 > 172.16.50.28.1434: UDP, length 10
> 02:42:45.744542 IP (tos 0x0, ttl  64, id 0, offset 0, flags [DF], proto:
> UDP (17), length: 38) 172.16.45.36.56931 > 172.16.50.28.1434: UDP, length 10
> 02:42:46.744630 IP (tos 0x0, ttl  64, id 0, offset 0, flags [DF], proto:
> UDP (17), length: 38) 172.16.45.36.56931 > 172.16.50.28.1434: UDP, length 10
> 02:42:47.744805 IP (tos 0x0, ttl  64, id 0, offset 0, flags [DF], proto:
> UDP (17), length: 38) 172.16.45.36.56931 > 172.16.50.28.1434: UDP, length 10
> 02:42:48.744941 IP (tos 0x0, ttl  64, id 0, offset 0, flags [DF], proto:
> UDP (17), length: 38) 172.16.45.36.56931 > 172.16.50.28.1434: UDP, length 10
>
>
> The server is indeed listening on port 1434. From the redhat box running
> tsql, I see this:
> telnet 172.16.50.28 1434
> Trying 172.16.50.28...
> telnet: connect to address 172.16.50.28: Connection refused
> telnet: Unable to connect to remote host: Connection refused

If the SQL Server is actually listening then the above clearly shows
there is some kind of firewall or similar blocking the connection to
port 1434.

-- 
Ramiro Morales
@ramiromorales


More information about the FreeTDS mailing list