A simple tool for testing MS SQL connections.
906
This image run a basic tool for testing MS SQL connections. The only requirement is define the DATABASE_URL environment variable with the expected format sqlserver://username:password@host:port?database=dbName¶m1=value.
The tool will show if the connection was successful or not, and the connections details after parsing the DATABASE_URL environment variable.
To test the connection with your MS SQL Server, using Docker:
export DATABASE_URL="sqlserver://username:password@host:port?database=dbName¶m1=value"
docker run --rm -e DATABASE_URL=$DATABASE_URL -it charles1888/test-mssql-connection:latest
Using Kubernetes:
cat << EOF | kubectl apply -f -
apiVersion: v1
kind: Pod
metadata:
name: test-mssql-connection
spec:
containers:
- name: test-mssql-connection
image: charles1888/test-mssql-connection:latest
env:
- name: DATABASE_URL
value: "sqlserver://username:password@host:port?database=dbName¶m1=value"
restartPolicy: OnFailure
nodeSelector:
kubernetes.io/os: linux
EOF
Please, note the above approach is not recommended because the DATABASE_URL content is exposed in the Pod's manifest, but can be fine for a quick test. The recommended approach is to use Kubernetes Secrets instead:
kubectl create secret generic test-mssql-connection \
--from-literal=DATABASE_URL='sqlserver://username:password@host:port?database=dbName¶m1=value'
Then reference the environment variable DATABASE_URL from the already created secret:
cat << EOF | kubectl apply -f -
apiVersion: v1
kind: Pod
metadata:
name: test-mssql-connection
spec:
containers:
- name: test-mssql-connection
image: charles1888/test-mssql-connection:latest
env:
- name: DATABASE_URL
valueFrom:
secretKeyRef:
name: test-mssql-connection
key: DATABASE_URL
restartPolicy: OnFailure
nodeSelector:
kubernetes.io/os: linux
EOF
To get the container output:
kubectl logs -f test-mssql-connection
Cleaning the stuff:
kubectl delete pod test-mssql-connection
kubectl delete secret test-mssql-connection
Content type
Image
Digest
Size
5.9 MB
Last updated
almost 5 years ago
docker pull charles1888/test-mssql-connection