I am trying to connect to a remote SQL Server 2008 from a bash file in a Ubuntu 14.04. I am using FreeTDS and the tsql
command to do so.
When I am in the same network as the SQL Server, I can access it using its local ip 192.168.0.2
, using the following command:
tsql -S 192.168.0.2 -U <user> -P <password>
The problem is when I try to connect using an IPv6. tsql doesn't seem to recognize the IPv6 I got. Here is what I get when trying to connect (the ip is anonymized):
tsql -S fe80::c74a:ada5:be2e:255f%11
Here is the result:
Error 20012 (severity 2):
Server name not found in configuration files.
locale is "en_US.UTF-8"
locale charset is "UTF-8"
using default charset "UTF-8"
Error 20013 (severity 2):
Unknown host machine name.
There was a problem connecting to the server
What am I doing wrong here? Any help is appreciated
The problem was that I was using freetds v0.91
(which was the latest version on apt-get), which does not have support for IPv6. I upgraded to the latest version, which can be found here. Any version above v0.95
should be fine.