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.
- Download the SQL Server ODBC driver for your Linux platform.
If your application is 32-bit, choose the 32-bit Linux distribution. Otherwise, choose the 64-bit one.
- Install and license the SQL Server ODBC driver on your Linux machine.
For installation instructions, refer to 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.
- 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 # Refer to https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/SQLServer.Concepts.General.SSL.Using.html CertificateFile=/home/mylinuxuser/Downloads/rds-ca-2015-root.pem
- Use isql to test the new data source. For example:
cd /usr/local/easysoft/unixODBC/bin ./isql.sh -v MSSQL-AWS
At the prompt, enter
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.