Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

While trying to connect remote SQL Server:

$tsql -S localhost -U myuser

I got error like:

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

The output of $tsql -C is as below:

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

I have created tunnel for remote server like:

$ssh -L 1433:db_server:1433 user@mid_server

This forward the local port 1433 to db_server. I tested. My ssh tunnel works because I can connect to database using Navicat (localhost on 1433). I can telnet localhost on port 1433.

like image 431
Elisa Avatar asked May 06 '13 08:05

Elisa


2 Answers

I kinda get it worked by modifying freetds.conf

from

[global]
    # TDS protocol version
;   tds version = 4.2

to

[global]
    # TDS protocol version
tds version = 7.0
like image 77
Elisa Avatar answered Sep 17 '22 19:09

Elisa


This worked for me with ASE 16.0 installed and running on Ubuntu 14.04 LTS, both client and server.

  • SERVER: Make sure there is an entry in /etc/hosts of your server (sybaseServer). In a standard Ubuntu 14.04 installation you will not find this, but "127.0.1.1 sybaseServer". But sybase seems depends on it.

/etc/hosts
...
192.168.1.100 sybaseServer
...

  • CLIENT: The entry in freetds.conf is

[SYBASE]
host = 192.168.1.100
port = 5000
tds version = 5.0

Now you can connect to your server:

$tsql -S SYBASE -U sa

  • obviously you have to replace IP-address, servername etc. with your own data
like image 35
Frank Avatar answered Sep 18 '22 19:09

Frank