SQLines Data - Configure and Troubleshoot Connection to SQL Server

If you are connecting to a SQL Server database on localhost you do not need to setup any additional libraries to use SQLines Data tool as they are supplied with Microsoft SQL Server.

If you need to connect to a remote SQL Server database, you need to have SQL Server ODBC Driver (since SQL Server 2022) or Native Client (deprecated since SQL Server 2022) installed in your local system.

Check if you already have SQL Server client libraries (most Windows systems already have them):

  • Windows:
    • %SYSTEMROOT%\System32\ (usually c:\Windows\System32)
      • msodbcsql17.dll or msodbcsql18.dll- SQL Server 2022 or later
      • sqlncli11.dll - SQL Server 2016, 2014 and 2012
      • sqlncli10.dll - SQL Server 2008
      • sqlsrv32.dll - SQL Server 2000
  • Linux:
    • /opt/microsoft/
      • /opt/microsoft/msodbcsql17/lib64/libmsodbcsql-17.7.so.2.1

If SQL Server client is not available, go to SQL Server download page to download a SQL Server ODBC Driver or Native Client. Note that SQL Server 2012 Native Client (sqlncli11.dll) is used with Microsoft SQL Server 2016, 2014 and 2012.

Installing SQL Server ODBC Driver on Linux

Follow instructions provided on Microsoft site, search - Install the Microsoft ODBC driver for SQL Server (Linux)

For example, for Red Hat Linux version 6 and ODBC Driver 17 for SQL Server

  curl http://packages.microsoft.com/config/rhel/6/prod.repo > /etc/yum.repos.d/mssql-release.repo
  
  # Install driver and its dependency unixODBC 2.3.7
  sudo ACCEPT_EULA=Y yum install -y msodbcsql17

Use -sql_lib command line or sqldata.cfg option to specify the library location i.e.

  -sql_lib=/opt/microsoft/msodbcsql17/lib64/libmsodbcsql-17.7.so.2.1

Troubleshoot Connection to SQL Server

Troubleshooting connection errors for SQL Server.

Named Pipes Provider: Could not open a connection to SQL Server [53]

Error 53 may mean you specified a bad network path. Check if the specified host name exists.

Named Pipes Provider: Could not open a connection to SQL Server [2]

Error 2 may mean you did not specified the instance name. Specify correct server_host\instance to connect to SQL Server.

SQL Server Network Interfaces: Error Locating Server/Instance Specified [xFFFFFFFF]

If you can get the following error message:

Check if you specified the valid server and instance name, for example, localhost\SQLEXPRESS.