I got it to work with a bit of external help, eventually.
Thanks to anyone who helped.
Original Message:
Sent: Fri October 25, 2024 08:24 AM
From: Ondřej Žižka
Subject: Issues with installing CSDK in Docker container to deploy in GCP
Can you set up a functional app/connection on some VM using the same ODBC configuration?
Another possible issue is that Informix SDK does not officially support Debian Buster, so you could try some supported OS.
------------------------------
Ondřej
Original Message:
Sent: Wed October 23, 2024 12:30 AM
From: Clement Martin
Subject: Issues with installing CSDK in Docker container to deploy in GCP
With some external help, we got the Dockerfile to work and successfully built the container.
Now I am testing my app.py script to see if I can test the connection with the db. But I am having more errors.
Here is my updated Dockerfile:
FROM python:3.9-slim-buster# InstallsENV DEBIAN_FRONTEND=noninteractiveRUN apt-get update && apt-get install -y \ unixodbc \ unixodbc-dev \ build-essential \ file \ libncurses5-dev \ libelf1 \ openjdk-11-jre-headless \ && apt-get clean \ && rm -rf /var/lib/apt/lists/*# Copy filesCOPY /drivers/installclientsdk /tmp/installclientsdkCOPY /src/conn.properties /tmp/conn.properties# Run the client SDK installerRUN chmod +x /tmp/installclientsdk \ && /tmp/installclientsdk -i silent -f /tmp/conn.properties || true# Set env variable and PATHENV INFORMIXDIR=/opt/IBM/Informix_Client-SDKENV LD_LIBRARY_PATH=${INFORMIXDIR}/lib:${INFORMIXDIR}/lib/esql:${INFORMIXDIR}/lib/cli# Populate odbcinst.ini RUN echo "[IBM INFORMIX ODBC DRIVER]" > /etc/odbcinst.ini && \ echo "Description=Informix ODBC Driver" >> /etc/odbcinst.ini && \ echo "Driver=/opt/IBM/Informix_Client-SDK/lib/cli/iclit09b.so" >> /etc/odbcinst.ini && \ echo "Setup=/opt/IBM/Informix_Client-SDK/lib/cli/iclit09b.so" >> /etc/odbcinst.ini# Install Python dependenciesCOPY /src/requirements.txt /app/requirements.txtRUN pip install --no-cache-dir -r /app/requirements.txtCOPY /src/app.py /app/app.pyWORKDIR /appCMD ["sh"]
Here is the app.py:
import pyodbccxn_string = \ 'DRIVER={IBM INFORMIX ODBC DRIVER};\ UID=user_name;\ PWD=12345;\ DATABASE=db;\ HOST=host.com;\ SERV=9088'\connection = pyodbc.connect(cxn_string)print('Successful connection')connection.close()
And here is the error message:
Traceback (most recent call last): File "/app/app.py", line 10, in <module> connection = pyodbc.connect(cxn_string)pyodbc.Error: ('H000', '[H000] [ (-11060) (SQLDriverConnect)')
------------------------------
Clement Martin
Original Message:
Sent: Wed October 16, 2024 07:42 PM
From: Clement Martin
Subject: Issues with installing CSDK in Docker container to deploy in GCP
I'm trying to set up a data pipeline from our IBM Informix database to GCP Bigquery. For that purpose, I have been trying to install the ODBC driver (within CSDK) in a Docker image to deploy the container later in Google Cloud Run Function.
I am stuck in the Dockerfile development and getting error messages when trying to build the container.
Here is the Dockerfile:
FROM ubuntu:latest# Install Python and driver managerRUN apt update RUN apt install -y python3 python3-pip unixodbc unixodbc-dev build-essential # Install necessary librariesRUN apt update RUN apt install -y file libncurses5-dev libelf1# Install JRERUN apt update RUN apt install -y openjdk-11-jre-headless# Install Python modulesRUN apt updateRUN apt install -y python3-pandas python3-pyodbc# Clean upRUN apt cleanRUN rm -rf /var/lib/apt/lists/*# Copy files to their destination foldersCOPY ibm.csdk.4.50.FC11.LNX.64bit.tar /tmp/COPY requirements.txt /app/requirements.txtCOPY main.py /app/main.py# Extra then delete the two .tar filesRUN tar -xf /tmp/ibm.csdk.4.50.FC11.LNX.64bit.tar -C /tmp/RUN tar -xf tmp/ibm.csdk.4.50.FC11.LNX.tar -C /tmp/RUN rm /tmp/ibm.csdk.4.50.FC11.LNX.64bit.tarRUN rm tmp/ibm.csdk.4.50.FC11.LNX.tar# Install the SDKRUN /tmp/installclientskd \ -DLICENSE_ACCEPTED=TRUE \ -DUSER_INSTALL_DIR=/opt/IBM/informix/4.50 \ -DCHOSEN_FEATURE_LIST=SDK,SDK-CPP,SDK-CPP-DEMO,SDK-ESQL,SDK-ESQL-ACM,SDK-ESQL-DEMO,SDK-LMI,SDK-ODBC,SDK-ODBC-DEMO,GLS,GLS-WEURAM,GLS-EEUR,GLS-JPN,GLS-KOR,GLS-CHN,GLS-OTH,DBA-DBA \ -DCHOSEN_INSTALL_FEATURE_LIST=SDK,SDK-CPP,SDK-CPP-DEMO,SDK-ESQL,SDK-ESQL-ACM,SDK-ESQL-DEMO,SDK-LMI,SDK-ODBC,SDK-ODBC-DEMO,GLS,GLS-WEURAM,GLS-EEUR,GLS-JPN,GLS-KOR,GLS-CHN,GLS-OTH,DBA-DBA \ -DCHOSEN_INSTALL_SET=Custom \ -DENCRYPTION_LIBRARY=GSKIT# Set environment variableENV INFORMIXDIR = /opt/IBM/Informix.4.50.FC11/lib/cli# Populate ocbcinst.iniRUN echo "[Informix]\n\Description = Informix ODBC Driver\n\Driver = /opt/IBM/Informix.4.50.FC11/lib/cli/iclit09b.so\n\Setup = /opt/IBM/Informix.4.50.FC11/lib/cli/iclit09b.so" >> /etc/odbcinst.ini# Set the working directoryWORKDIR /appCMD ["sh"]
And here is the error returned when I try building the container:
=> ERROR [19/21] RUN /tmp/installclientskd -DLICENSE_ACCEPTED=TRUE -DUSER_INSTALL_DIR=/opt/IBM/informix/4.50 -DCHOSEN_FEATURE_LIST=SDK,SDK-CPP,SDK-CPP-DEMO,SDK-ESQL,SDK-ESQL-ACM,SDK-ESQL-DEMO,SDK-LMI,SDK-ODBC,SD 0.5s ------ > [19/21] RUN /tmp/installclientskd -DLICENSE_ACCEPTED=TRUE -DUSER_INSTALL_DIR=/opt/IBM/informix/4.50 -DCHOSEN_FEATURE_LIST=SDK,SDK-CPP,SDK-CPP-DEMO,SDK-ESQL,SDK-ESQL-ACM,SDK-ESQL-DEMO,SDK-LMI,SDK-ODBC,SDK-ODBC-DEMO,GLS,GLS-WEURAM,GLS-EEUR,GLS-JPN,GLS-KOR,GLS-CHN,GLS-OTH,DBA-DBA -DCHOSEN_INSTALL_FEATURE_LIST=SDK,SDK-CPP,SDK-CPP-DEMO,SDK-ESQL,SDK-ESQL-ACM,SDK-ESQL-DEMO,SDK-LMI,SDK-ODBC,SDK-ODBC-DEMO,GLS,GLS-WEURAM,GLS-EEUR,GLS-JPN,GLS-KOR,GLS-CHN,GLS-OTH,DBA-DBA -DCHOSEN_INSTALL_SET=Custom -DENCRYPTION_LIBRARY=GSKIT:0.488 /bin/sh: 1: /tmp/installclientskd: not found------ 1 warning found (use docker --debug to expand): - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 44)Dockerfile:35--------------------HN,GLS-OTH,DBA-DBA -DCHOSEN_INSTALL_SET=Custom -DENCRYPTION_LIBRARY=GSKIT:0.488 /bin/sh: 1: /tmp/installclientskd: not found------ 1 warning found (use docker --debug to expand): - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 44)Dockerfile:35-------------------------- 1 warning found (use docker --debug to expand): - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 44)Dockerfile:35-------------------- - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 44)Dockerfile:35-------------------- 34 | # Install the SDK-------------------- 34 | # Install the SDK 35 | >>> RUN /tmp/installclientskd \ 34 | # Install the SDK 35 | >>> RUN /tmp/installclientskd \ 35 | >>> RUN /tmp/installclientskd \ 36 | >>> -DLICENSE_ACCEPTED=TRUE \ 36 | >>> -DLICENSE_ACCEPTED=TRUE \ 37 | >>> -DUSER_INSTALL_DIR=/opt/IBM/informix/4.50 \ 38 | >>> -DCHOSEN_FEATURE_LIST=SDK,SDK-CPP,SDK-CPP-DEMO,SDK-ESQL,SDK-ESQL-ACM,SDK-ESQL-DEMO,SDK-LMI,SDK-ODBC,SDK-ODBC-DEMO,GLS,GLS-WEURAM,GLS-EEUR,GLS-JPN,GLS-KOR,GLS-CHN,GLS-OTH,DBA-DBA \ 39 | >>> -DCHOSEN_INSTALL_FEATURE_LIST=SDK,SDK-CPP,SDK-CPP-DEMO,SDK-ESQL,SDK-ESQL-ACM,SDK-ESQL-DEMO,SDK-LMI,SDK-ODBC,SDK-ODBC-DEMO,GLS,GLS-WEURAM,GLS-EEUR,GLS-JPN,GLS-KOR,GLS-CHN,GLS-OTH,DBA-DBA \ 39 | >>> -DCHOSEN_INSTALL_FEATURE_LIST=SDK,SDK-CPP,SDK-CPP-DEMO,SDK-ESQL,SDK-ESQL-ACM,SDK-ESQL-DEMO,SDK-LMI,SDK-ODBC,SDK-ODBC-DEMO,GLS,GLS-WEURAM,GLS-EEUR,GLS-JPN,GLS-KOR,GLS-CHN,GLS-OTH,DBA-DBA \ 40 | >>> -DCHOSEN_INSTALL_SET=Custom \ 41 | >>> -DENCRYPTION_LIBRARY=GSKIT 42 |----------------------------------------ERROR: failed to solve: process "/bin/sh -c /tmp/installclientskd -DLICENSE_ACCEPTED=TRUE -DUSER_INSTALL_DIR=/opt/IBM/informix/4.50 -DCHOSEN_FEATURE_LIST=SDK,SDK-CPP,SDK-CPP-DEMO,SDK-ESQL,SDK-ESQL-ACM,SDK-ESQL-DEMO,SDK-ERROR: failed to solve: process "/bin/sh -c /tmp/installclientskd -DLICENSE_ACCEPTED=TRUE -DUSER_INSTALL_DIR=/opt/IBM/informix/4.50 -DCHOSEN_FEATURE_LIST=SDK,SDK-CPP,SDK-CPP-DEMO,SDK-ESQL,SDK-ESQL-ACM,SDK-ESQL-DEMO,SDK-LMI,SDK-ODBC,SDK-ODBC-DEMO,GLS,GLS-WEURAM,GLS-EEUR,GLS-JPN,GLS-KOR,GLS-CHN,GLS-OTH,DBA-DBA -DCHOSEN_INSTALL_FEATURE_LIST=SDK,SDK-CPP,SDK-CPP-DEMO,SDK-ESQL,SDK-ESQL-ACM,SDK-ESQL-DEMO,SDK-LMI,SDK-ODBC,SDK-ODBC-DEMO,GLS,GLS-WEURAM,GLS-EEUR,GLS-JPN,GLS-KOR,GLS-CHN,GLS-OTH,DBA-DBA -DCHOSEN_INSTALL_SET=Custom -DENCRYPTION_LIBRARY=GSKIT" did not complete successfully: exit code: 127PS G:\My Drive\Python\Docker>LS-EEUR,GLS-JPN,GLS-KOR,GLS-CHN,GLS-OTH,DBA-DBA -DCHOSEN_INSTALL_SET=Custom -DENCRYPTION_LIBRARY=GSKIT" did not complete successfully: exit code: 127PS G:\My Drive\Python\Docker>LS-EEUR,GLS-JPN,GLS-KOR,GLS-CHN,GLS-OTH,DBA-DBA -DCHOSEN_INSTALL_SET=Custom -DENCRYPTION_LIBRARY=GSKIT" did not complete successfully: exit code: 127PS G:\My Drive\Python\Docker>LS-EEUR,GLS-JPN,GLS-KOR,GLS-CHN,GLS-OTH,DBA-DBA -DCHOSEN_INSTALL_SET=Custom -DENCRYPTION_LIBRARY=GSKIT" did not complete successfully: exit code: 127PS G:\My Drive\Python\Docker>LS-EEUR,GLS-JPN,GLS-KOR,GLS-CHN,GLS-OTH,DBA-DBA -DCHOSEN_INSTALL_SET=Custom -DENCRYPTION_LIBRARY=GSKIT" did not complete successfully: exit code: 127
And here is the odbctrace.log file:
[ODBC][15][1729706220.047311][__handles.c][460] Exit:[SQL_SUCCESS] Environment = 0x55ddd32384b0[ODBC][15][1729706220.047349][SQLAllocHandle.c][377] Entry: Handle Type = 2 Input Handle = 0x55ddd32384b0[ODBC][15][1729706220.047354][SQLAllocHandle.c][493] Exit:[SQL_SUCCESS] Output Handle = 0x55ddd3238dc0[ODBC][15][1729706220.047362][SQLConnect.c][3752] Entry: Connection = 0x55ddd3238dc0 Server Name = [ser][length = 3 (SQL_NTS)] User Name = [NULL] Authentication = [NULL][ODBC][15][1729706220.047568][SQLConnect.c][3960]Error: IM002[ODBC][15][1729706220.047624][SQLFreeHandle.c][290] Entry: Handle Type = 2 Input Handle = 0x55ddd3238dc0[ODBC][15][1729706220.047646][SQLFreeHandle.c][339] Exit:[SQL_SUCCESS][ODBC][15][1729706220.047651][SQLFreeHandle.c][220] Entry: Handle Type = 1 Input Handle = 0x55ddd32384b0[ODBC][16][1729706220.130400][__handles.c][460] Exit:[SQL_SUCCESS] Environment = 0x558c6e408d10[ODBC][16][1729706220.130424][SQLSetEnvAttr.c][189] Entry: Environment = 0x558c6e408d10 Attribute = SQL_ATTR_ODBC_VERSION Value = 0x3 StrLen = 4[ODBC][16][1729706220.130428][SQLSetEnvAttr.c][381] Exit:[SQL_SUCCESS][ODBC][16][1729706220.130435][SQLDrivers.c][235] Entry: Environment = 0x558c6e408d10 Direction = 2[ODBC][16][1729706220.130458][SQLDrivers.c][510] Exit:[SQL_SUCCESS][ODBC][16][1729706220.130461][SQLDrivers.c][235] Entry: Environment = 0x558c6e408d10 Direction = 1[ODBC][16][1729706220.130471][SQLDrivers.c][510] Exit:[SQL_NO_DATA][ODBC][16][1729706220.130924][SQLAllocHandle.c][377] Entry: Handle Type = 2 Input Handle = 0x558c6e408d10[ODBC][16][1729706220.130941][SQLAllocHandle.c][493] Exit:[SQL_SUCCESS] Output Handle = 0x558c6e409310[ODBC][16][1729706220.134863][SQLDriverConnectW.c][290] Entry: Connection = 0x558c6e409310 Window Hdl = (nil) Str In = [ DRIVER={IBM INFORMIX ODBC DRIVER}; DSN=dns; SERVER=server; DATABASE=db; HOST=host..][length = 237 (SQL_NTS)] Str Out = (nil) Str Out Max = 0 Str Out Ptr = (nil) Completion = 0 UNICODE Using encoding ASCII 'UTF-8' and UNICODE 'UCS-2LE'[ODBC][16][1729706220.142265][SQLDriverConnectW.c][699] Exit:[SQL_ERROR][ODBC][16][1729706220.142291][SQLGetDiagRecW.c][516] Entry: Connection = 0x558c6e409310 Rec Number = 1 SQLState = 0x7fff0f32a824 Native = 0x7fff0f32a7fc Message Text = 0x558c6e425330 Buffer Length = 1023 Text Len Ptr = 0x7fff0f32a7fa[ODBC][16][1729706220.142298][SQLGetDiagRecW.c][563] Exit:[SQL_SUCCESS] SQLState = [H] Native = 0x7fff0f32a7fc -> -11060 Message Text = [[][ODBC][16][1729706220.142334][SQLFreeHandle.c][290] Entry: Handle Type = 2 Input Handle = 0x558c6e409310[ODBC][16][1729706220.142339][SQLFreeHandle.c][339] Exit:[SQL_SUCCESS]
Can someone help me to see where I went wrong?
------------------------------
Clement Martin
------------------------------