Debugging Snowflake ODBC driver
298
Instructions.
docker run -d --name odbc eduard93/snowflakedocker logs odbc
The following line indicates that the app is fully started: [INFO] ...executed command /docker-entrypoint.sh iris-after-startdocker exec -it odbc bashnano /usr/irissys/mgr/irisodbc.iniiris session iris '##class(Utils.ODBC).Test(,"usr","password")'
You’ll see process id and after that the process hangs.iris session iris
b. Run the same thing interactively: do ##class(Utils.ODBC).Test(,"usr","password")docker stop odbcFirst argument of the Utils.ODBC:Test method is the DSN name and I’m defaulting to Snowflake.
Dockerfile
# The base IRIS image. Modify the build script argument to use a different version.
ARG IMAGE=intersystemsdc/iris-community
FROM $IMAGE
# Get some dependencies with root power
USER root
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \
unixodbc nano
RUN wget https://sfc-repo.snowflakecomputing.com/odbc/linux/3.3.2/snowflake-odbc-3.3.2.x86_64.deb \
&& dpkg -i snowflake-odbc-3.3.2.x86_64.deb
RUN cp /usr/lib/x86_64-linux-gnu/libodbcinst.so.2 /usr/lib/x86_64-linux-gnu/libodbcinst.so.1
# Install apache as the same non-root user who owns the IRIS instance
# and is the default user for this container, so that default user
# can start and stop Apache, modify config files, etc.
USER ${ISC_PACKAGE_MGRUSER}
WORKDIR /home/irisowner/irisbuild
RUN --mount=type=bind,src=.,dst=. \
cp /home/irisowner/irisbuild/irisodbc.ini $ISC_PACKAGE_INSTALLDIR/mgr/irisodbc.ini && \
iris start IRIS && \
iris session IRIS < iris.script && \
iris stop IRIS quietly
iris.script
do $system.OBJ.Load("/home/irisowner/irisbuild/ODBC.cls", "ck")
halt
ODBC.cls
Class Utils.ODBC
{
ClassMethod Test(dsn="Snowflake",usr,pwd)
{
write "Process id: ",$j,!
set gc=##class(%SQLGatewayConnection).%New()
set sc=gc.Connect(dsn,usr,pwd,0) // This line calls C code and hangs
write "SUCCESS", !
set ^dbg($j, $i(^dbg($j))) = "Connect"
}
}
irisodbc.ini
[ODBC Data Sources]
Snowflake=Snowflake
[Snowflake]
Driver = /usr/lib/snowflake/odbc/lib/libSnowflake.so
Description = TEST
server = !!!.snowflakecomputing.com
database = !!!
warehouse = !!!
Content type
Image
Digest
sha256:778aded86…
Size
1.1 GB
Last updated
about 2 years ago
docker pull eduard93/snowflake