Connecting to an SQL Server database from Altair SLC on Linux

IanBD
IanBD
Altair Employee
edited September 2022 in Altair RapidMiner

If you have data stored in a SQL Server database, you can connect using the Microsoft ODBC Driver for SQL Server. To install the client you need to:

  1. Download the Microsoft configuration repository using the following commands:
    sudo -i 
    curl https://packages.microsoft.com/config/linux-distribution/version/prod.repo > /etc/yum.repos.d/msprod.repo
    exit

    Where linux-distribution is the absolute path to the download location, and version is the version of the Linux distribution; for example a Red Hat Enterprise 7 system would write /rhel/7/.

  2. Install the mssql-tools package and its dependencies using the following command:
    sudo yum install mssql-tools

    You are prompted to accept the size of the installation and the licence terms.
    Enter YES or y where required.

  3. Include the data source name (DSN) information in the ODBC files. The unixODBC installation adds the files /etc/odbc.ini and /etc/odbcinst.ini to your system, if the files do not exist.
    • The odbcinst.ini file should already contain DSN information.
      Edit the file and change the driver name to SQL Server.
    • Add the following lines to /etc/odbc.ini:
      [SQL Server]
      Server=server-name[, port-number]
      Driver=/opt/microsoft/msodbcsql-version/lib64/libmsodbcsql-version
      Description=My SQL Server ODBC Driver

      Where you replace server-name and, if required, port-number with your corresponding server credentials. Replace msodbcsql-version with your version of msodbcsql and libmsodbcsql-version with your version of the libmsodbcsql shared object file.

Once the client has been installed, you can test the connection using the following SAS language program:

LIBNAME DATASRC SQLSVR USER=user-name PASSWORD=password
SERVER=server-id DATABASE=dbase;
PROC DATASETS LIBRARY=DATASRC;
RUN;
  • In the LIBNAME statement, replace user-name and password with your user name and password for the remote-id server, and replace dbase with the name of the SQL Server database.
  • The DATASETS procedure returns the names of all tables in the selected database; for databases with large numbers of tables, this program might take some time to run.

Welcome!

It looks like you're new here. Sign in or register to get started.

Welcome!

It looks like you're new here. Sign in or register to get started.