Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FreeTDS - Unable to connect: Adaptive Server is unavailable or does not exist

CENTOS 6.5 x86_64 WHM 11.42.1 unixODBC 2.2.14

freetds v0.91

I'm trying to connect to remote MSSQL server without success - also tried connecting with different tds versions (4.2, 7.0, 7.1, 8.0) but all give the same result.

Using the same servername, port, username and password, I'm able to connect via my desktop using Win7 and SQL Server Management Studio.

Telnet also fails.

Details follow. Please let me know if you need any more. All help/advice appreciated.

========

tsql -C

Compile-time settings (established with the "configure" script)
                            Version: freetds v0.91
             freetds.conf directory: /etc
     MS db-lib source compatibility: yes
        Sybase binary compatibility: yes
                      Thread safety: yes
                      iconv library: yes
                        TDS version: 4.2
                              iODBC: no
                           unixodbc: yes
              SSPI "trusted" logins: no
                           Kerberos: yes

========

tsql -H testDSN -pXXXX -U 'testuser' -P 'testpass'

locale is "en_US.UTF-8"
locale charset is "UTF-8"
using default charset "UTF8"
20Error 20009 (severity 9):
        Unable to connect: Adaptive Server is unavailable or does not exist
        OS error 110, "Connection timed out"
There was a problem connecting to the server

=======

isql -v testDSN 'testuser' 'testpass'

[S1000][unixODBC][FreeTDS][SQL Server]Unable to connect to data source
[08S01][unixODBC][FreeTDS][SQL Server]Unable to connect: Adaptive Server is unavailable or does not exist
[ISQL]ERROR: Could not SQLConnect

======== osql -S testDSN -U 'testuser' -P 'testpass' ...

Configuration looks OK.  Connection details:

                   DSN: testDSN
              odbc.ini: /etc/odbc.ini
                Driver: /usr/lib64/libtdsodbc.so
       Server hostname: winsrv106.pleskdns.co.uk
               Address: x.x.x.x

Attempting connection as testuser ...
+ isql testDSN testuser 'testpass' -v
[S1000][unixODBC][FreeTDS][SQL Server]Unable to connect to data source
[08S01][unixODBC][FreeTDS][SQL Server]Unable to connect: Adaptive Server is unavailable or does not exist
[ISQL]ERROR: Could not SQLConnect
net.c:205:FAILED Connecting to x.x.x.x port XXXX (TDS version 7.1)

========

more freetds.log

log.c:196:Starting log file for FreeTDS 0.91
        on 2014-04-10 15:33:03 with debug flags 0x4fff.
iconv.c:330:tds_iconv_open(0x7233e0, UTF8)
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 "UTF8"
iconv.c:351:preparing iconv for "UTF8" <-> "UCS-2LE" conversion
iconv.c:391:preparing iconv for "ISO-8859-1" <-> "UCS-2LE" conversion
iconv.c:394:tds_iconv_open: done
net.c:205:Connecting to x.x.x.x port XXXX (TDS version 7.1)
net.c:270:tds_open_socket: connect(2) returned "Operation now in progress"
net.c:306:getsockopt(2) reported: Connection timed out
net.c:316:tds_open_socket() failed
util.c:331:tdserror(0x723140, 0x7233e0, 20009, 110)
util.c:361:tdserror: client library returned TDS_INT_CANCEL(2)
util.c:384:tdserror: returning TDS_INT_CANCEL(2)
mem.c:615:tds_free_all_results()

========

telnet x.x.x.x

Trying x.x.x.x... 
telnet: connect to address x.x.x.x: 
Connection timed out
like image 330
user247497 Avatar asked Apr 10 '14 14:04

user247497


2 Answers

I had the same problem and solved it by using a custom port: port = XXXXX in freetds.conf This port should be configured in SQL Server Configuration Mgnt

SQL Server Network Configuration -> TCP/IP (enabled) -> IP Addresses -> IPAll -> TCP Dynamic Ports

https://msdn.microsoft.com/en-us/library/ms177440.aspx

like image 100
Dimitris Avatar answered Nov 03 '22 12:11

Dimitris


I run MS Windows in VirtualBox.

So for me to access MS SQLServer from my mac host I must:

  • Add Port Forwarding entry in VirtualBox > Devices > Network > Network Settings > Advanced

  • Open Port 1444 in MS Control Panel > Windows Firewall > Advanced Settings > Inbound Rules

  • Start SQL Server Browser in SQL Server Configuration Manager > SQL Server Services

  • Enable TCP in SQL Server Configuration Manager > Protocols

  • Set TCP Port to 1444 for TCPAll in SQL Server Configuration Manager > Protocols > TCP/IP > Properties...

Set TCP Port to 1444

Note that MS SQL Server is configured to listen on port 1444.

like image 39
l3x Avatar answered Nov 03 '22 13:11

l3x