libdb2.so.1: cannot open shared object file: No such file or directory – … ibm_db.so

Got this error while deploying a Rails app on Nginx:

libdb2.so.1: cannot open shared object file: No such file or directory - ... ibm_db.so

This means that the ibm_db adapter is installed, but it can’t find the DB2 libraries. The issue is that IBM_DB_HOME and some other environment variables are not set.

The best solution is to make sure all users have db2profile loaded. Edit /etc/profile and add:

. /opt/dsdriver/db2profile

You should now reload your profile (. /etc/profile) and restart Nginx.

This assumes that you already have IBM Data Server Driver installed under /opt/dsdriver.

One thought on “libdb2.so.1: cannot open shared object file: No such file or directory – … ibm_db.so

  1. part Dockerfile Jenkins db2cli

    USER root
    RUN echo “jenkins ALL=NOPASSWD: ALL” >> /etc/sudoers
    COPY db2cli.tar.gz /opt/
    RUN tar xvzf /opt/db2cli.tar.gz -C /opt \
    && cd /opt/dsdriver/; sed -i s#/bin/ksh#/bin/bash#g ./installDSDriver \
    && ./installDSDriver \
    && chown -R root:root /opt/dsdriver

    ENV PATH=”/opt/dsdriver/bin/:/opt/dsdriver/adm/:${PATH}” \
    DYLD_LIBRARY_PATH=”/opt/dsdriver/lib” \
    LD_LIBRARY_PATH=”/opt/dsdriver/lib” \
    CLASSPATH=”/opt/dsdriver/java/db2jcc.jar”:”$CLASSPATH” \
    CLASSPATH=”/opt/dsdriver/java/sqlj.zip”:”$CLASSPATH” \
    IBM_DB_DIR=”/opt/dsdriver” \
    IBM_DB_HOME=”/opt/dsdriver” \
    IBM_DB_LIB=”/opt/dsdriver/lib” \
    IBM_DB_INCLUDE=”/opt/dsdriver/include” \
    DB2_HOME=”/opt/dsdriver/include” \
    DB2LIB=”/opt/dsdriver/lib”
    USER jenkins

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.