Connecting Applications running on Linux to Amazon Relational Database Services (RDS) for SQL Server

This blog shows how to connect Linux applications to SQL Server on Amazon Web Services (AWS). The instructions are equally applicable to applications running on UNIX platforms. Where the instructions tell you to download the Linux version of the SQL Server ODBC driver, choose the driver for your UNIX platform instead.

If you have configured your SQL Server instance to insist on TLS 1.2, you need to use build 1.10.8 or later of the SQL Server ODBC driver.

  1. Download the SQL Server ODBC driver for your Linux platform. (Registration required.)

    If your application is 32-bit, choose the 32-bit Linux distribution. Otherwise, choose the 64-bit one.

  2. Install and license the SQL Server ODBC driver on your Linux machine.

    For installation instructions, see the ODBC driver documentation.

    Note You need the unixODBC Driver Manager installed on your machine. The Easysoft distribution includes a version of the unixODBC Driver Manager that the Easysoft SQL Server ODBC driver has been tested with. The Easysoft driver setup program gives you the option to install unixODBC.

  3. Create an ODBC data source in /etc/odbc.ini that connects to the SQL Server database you want to access from Linux. For example:
    [MSSQL-AWS]
    Driver          = Easysoft ODBC-SQL Server SSL
    Server= myuser.mymachine.eu-west-2.rds.amazonaws.com
    User            = my_mssql_user
    Password        = my_password
    Trusted_Connection=No
    TrustServerCertificate=Yes
    # See https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/SQLServer.Concepts.General.SSL.Using.html 
    CertificateFile=/home/mylinuxuser/Downloads/rds-ca-2015-root.pem
    
  4. Use isql to test the new data source. For example:
    cd /usr/local/easysoft/unixODBC/bin
    ./isql.sh -v MSSQL-AWS
    

    At the prompt, type "help" to display a list of tables. To exit, press return in an empty prompt line.

    If you are unable to connect, refer to this article and the SQL Server ODBC Driver Knowledge Base for assistance.