Skip to content

Virtuoso OpenSource Edition

Patrick van Kleef edited this page Jan 9, 2019 · 3 revisions

Welcome

DSN-less connections

Before calling the node-isql.js the docker-entrypoint.sh script creates an environment variable called ODBC_CONNECT_STRING which concats the following key=value;key=value pairs to form the ODBC connect string.

    key              value

    DRIVER           /opt/virtuoso-opensource/lib/virtodbcu_r.so
    HOST             $VIRT_HOST
    UID              $VIRT_UID
    PWD              $VIRT_PWD
    WideAsUTF16      1
    CHARSET          UTF-8

resulting in:

export ODBC_CONNECT_STRING="DRIVER=/opt/virtuoso-opensource/lib/virtodbcu_r.so;HOST=$VIRT_HOST;UID=$VIRT_UID;PWD=$VIRT_PWD;WideAsUTF16=1;CHARSET=UTF-8"

Example

$ docker run -i -t -e VIRT_HOST=example.com:4321 openlink/node-isql localhost:1234 demo

which the docker-entrypoint.sh script interprets as:

  1. environment variable VIRT_HOST is specified and set to example.com:4321
  2. environment variable VIRT_UID is not set, so defaults to dba
  3. environment variable VIRT_PWD is not set, so defaults to dba
  4. argument 1 is supplied, so VIRT_HOST is set to localhost:1234
  5. argument 2 is supplied, so VIRT_UID is set to demo
  6. argument 3 is not supplied, so VIRT_PWD remains dba
  7. VIRT_HOST is rewritten from localhost:1234 to host.docker.internal:1234
    environment         value

    VIRT_HOST           host.docker.internal:1234
    VIRT_UID            demo
    VIRT_PWD            dba

and the final connect string is:

export ODBC_CONNECT_STRING="DRIVER=/opt/virtuoso-opensource/lib/virtodbcu_r.so;HOST=host.docker.internal.1234;UID=demo;PWD=dba;WideAsUTF16=1;CHARSET=UTF-8"