Created
May 22, 2019 21:06
-
-
Save dolanor/8af1950b32a77c90dad9cbb2aaf63ed6 to your computer and use it in GitHub Desktop.
Test Go ODBC compatibility with a contained MS SQL Server instance
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
cid=`docker run --name go-odbc-mssql-server -d -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=notVERYstrongP455word.' -d mcr.microsoft.com/mssql/server:2017-CU8-ubuntu` | |
mssqlIP=$(docker inspect --format "{{ .NetworkSettings.Networks.bridge.IPAddress }}" ${cid}) | |
docker run --rm -it golang:1.12 sh -c " | |
apt update | |
apt install -y tdsodbc unixodbc-dev freetds-bin | |
cat > /etc/odbcinst.ini << EOF | |
[FreeTDS] | |
Description = FreeTDS | |
Driver = /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so | |
EOF | |
go get -v -t -d github.com/alexbrainman/odbc | |
cd /go/src/github.com/alexbrainman/odbc/ | |
go test -run=MS -mssrv=${mssqlIP} -msdb=master -msport=1433 -msdriver=freetds -mspass=notVERYstrongP455word. -msuser=SA" | |
docker rm -f ${cid} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment