I have an AWS Lambda based on brefphp to connect to a snowflake data warehouse.
For this I use :
- runtime: php-84
${bref-extra:odbc-snowflake-php-84}
I get this error, when calling obdc_connect:
"odbc_connect(): SQL error: [unixODBC][Driver Manager]Driver's SQLAllocHandle on SQL_HANDLE_HENV failed, SQL state IM004 in SQLConnect"
I found that by manually building the odbc-snowflake layer based on :
https://github.com/brefphp/extra-php-extensions/blob/master/layers/odbc-snowflake/Dockerfile
The error occurs when using any version of the snowflake odbc linux driver higher than 2.25.12
# https://docs.snowflake.com/en/user-guide/odbc-download.html
# https://sfc-repo.snowflakecomputing.com/odbc/linux/3.0.1/index.html
# also: strip more than 100 mb of debug symbols
RUN curl https://sfc-repo.snowflakecomputing.com/odbc/linux/3.0.1/snowflake_linux_x8664_odbc-3.0.1.tgz | tar xzv --directory /tmp \
&& strip -g /tmp/snowflake_odbc/lib/libSnowflake.so
# modify the config files for the new final location in /opt/snowflake_odbc
RUN sed -i 's#/path/to/your/#/opt/snowflake_odbc/lib/#g' /tmp/snowflake_odbc/conf/*
I can't find the cause of this error.