ODBC

Connecting to MS SQL using ODBC

You need drivers:

The SQL Server on windows may still have to open TCP. See: https://technet.microsoft.com/en-us/library/hh231672(v=sql.110).aspx

Troubleshooting

Troubleshoot using sqlcmd first:

sqlcmd -S <serverip> -U <user> -P <password>

# eg:
sqlcmd -S 10.37.129.3 -U sysop -P secret

Valid DSN paramaters: https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/connection-string-keywords-and-data-source-names-dsns

Connect using isql (to test unixodbc):

isql -vk "Driver={ODBC Driver 13 for SQL Server};Server=<serverip>,1433;UID=<user>;PWD=<password>"

# eg:
isql -k "Driver={ODBC Driver 13 for SQL Server};Server=10.37.129.3,1433;UID=sysop;PWD=secret"

When connected, find your database

select name from sys.databases;

use [sqlserver administratie]; #or another database name

useful tools

Connecting to MySQL using ODBC

The WebHare docker ships with configured pgsql and mysql odbc connectors and the isql binary.

To connect to a database directly, use isql, eg:

isql -k "Driver=MySQL;Server=10.11.12.13;Database=<dbname>;Uid=<uid>;Pwd=<password>;"

macOS requires some manual installation. MySQL doesn't appear to have a stable, usable odbc provider available currently (we can't get the recent online versions to work, they appear to only work with iodbc and not unixodbc) but MariaDB's ODBC connector should be compatible

[MaODBC]
Driver=/usr/local/lib/libmaodbc.dylib
UsageCount=1
isql -k "Driver=MaODBC;Server=10.11.12.13;Database=<dbname>;Uid=<uid>;Pwd=<password>;"