Not able to connect to MS SQL DB instance with ms sql driver 13 from Linux 7(CentOS7) Env

694 Views Asked by At

I am trying to connect from Linux virtual environment to MS SQL Server instance using ms sql driver 13.

[<user> ~]$ which odbcinst
/usr/bin/odbcinst
[<user> ~]$ odbcinst -j
unixODBC 2.3.1
DRIVERS............: /etc/odbcinst.ini
SYSTEM DATA SOURCES: /etc/odbc.ini
FILE DATA SOURCES..: /etc/ODBCDataSources
USER DATA SOURCES..: /home/<user>/.odbc.ini
SQLULEN Size.......: 8
SQLLEN Size........: 8
SQLSETPOSIROW Size.: 8
[<user> ~]$ cat /etc/odbc.ini
[DNSname-1]
Driver = ODBC Driver 13 for SQL Server
SERVER=server-1
DATABASE=DB1

[DNSname-2]
Driver = ODBC Driver 13 for SQL Server
SERVER=server-2\instance-1
Database=DB2
[<user> ~]$ isql DNSname-1 userid1 passwd1
+---------------------------------------+
| Connected!                            |
|                                       |
| sql-statement                         |
| help [tablename]                      |
| quit                                  |
|                                       |
+---------------------------------------+
SQL> quit

isql is able to connect to ms sql server

[<root> ~]$ isql -v DNSname-2 userid2 passwd2
[S1T00][unixODBC][Microsoft][ODBC Driver 13 for SQL Server]Login timeout expired
[08001][unixODBC][Microsoft][ODBC Driver 13 for SQL Server]MAX_PROVS: Error Locating Server/Instance Specified [xFFFFFFFF].
[08001][unixODBC][Microsoft][ODBC Driver 13 for SQL Server]A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online.
[ISQL]ERROR: Could not SQLConnect

But When I try to connect to sql db instance, isql is giving an error as "Login timeout expired"

0

There are 0 best solutions below