0

I compiled a C++ code on a linux box with DB2 connectivity . The binary got compiled and it is running successfully on that box. However when I deployed the same binary on a different linux box, I am getting 818 error on that box.

EmmMktStatus is the binary that uses libSTDbConnection.so library to connect to DB2 and perform operations like select,delete update etc.

Steps For Compilation:

1/ Database Connectivity Library Compilation :(libSTDbConnection.so)

Connect To DB2

-- db2 connect to ****** user ***** using *****

Creating .i File (Done to include #define variables in sqC code)

db2 "prep STDbConnection.sqC PREPROCESSOR 'gcc -fPIC -I"/home0/db2inst1/sqllib/include" -I"/home0/db2inst1/DB2" -I/"/home0/u556899/Application/Source/Header" -I"/home0/u556899/Application/Source/Dal/Hdr" -I"/home0/u556899/log4cpp/include/log4cpp" -I"/home0/u556899/log4cpp/include" -O0 -g3 -Wall -c -fmessage-length=0 -E -o STDbConnection.i' COMPATIBILITY_MODE ORA LONGERROR NO bindfile"

Creating bind file from .i file

db2 bind STDbConnection.bnd

Creating object file

gcc -fPIC -I"/home0/db2inst1/sqllib/include" -I"/home0/db2inst1/DB2" -I/"/home0/u556899/Application/Source/Header" -I"/home0/u556899/Application/Source/Dal/Hdr" -I"/home0/u556899/log4cpp/include/log4cpp" -I"/home0/u556899/log4cpp/include" -O0 -g3 -Wall -c -fmessage-length=0 -o STDbConnection.o STDbConnection.C

Creating library (.so) file

gcc -shared -L"/home0/db2inst1/sqllib/include" -L"/home0/db2inst1/DB2" -L/home0/u556899/Application/Lib -lLog4Cpp2 -L"/home0/db2inst1/sqllib/bin" -o libSTDbConnection.so STDbConnection.o STColumn.o STWhereStatement.o -L/home0/ibm/db2/V11.1/lib64 -ldb2 -L/home0/u556899/Application/Lib -lLog4Cpp2

2/ Creating Binary (EmmMktStatus) using libSTDbConnection.so library

Creating object file

gcc -fPIC -c -g "-DOPENSSL_NO_KRB5" -I/home0/jdk1.7.0_67/include -I/home0/jdk1.7.0_67/include/linux -I/home0/u556899/Application/Source/Header -I/home0/u556899/log4cpp/include/log4cpp -I/home0/u556899/log4cpp/include/ -I/home0/u556899/Application/Source/Dal/Hdr -I/opt/mqm/inc -I/usr/include -I/usr/include/libxml2 -I"/home0/db2inst1/sqllib/include" -I"/home0/db2inst1/DB2" -I"/home0/u556899/log4cpp/include" /home0/u556899/Application/Source/Its/EmmMktStatus.cpp

Creating binary EmmMktStatus:

gcc -o EmmMktStatus -I/home0/u556899/Application/Source/Header /home0/u556899/Application/Objects/EmmMktStatus.o /home0/u556899/Application/Objects/STString.o /home0/u556899/Application/Objects/Log4CppMain2.o -L. -L/usr/lib/gcc/x86_64-redhat-linux/4.1.1 -lstdc++ -L/usr/lib64 -lcrypto -L/home0/u556899/Application/Lib -lSTDbConnection -llog4cpp

Using above compilation steps , I form the EmmMktStatus executable. It is running successfully on the same linux server where it is compiled. However when I deploy EmmMktStatus on different linux server I get 818 error in db2.

Both the boxes have same linux version. Also both the boxes have same db2 verion - v11.1.0.0 and Fix pack "0".

Could somebody suggest any issues in above compilation steps.

Note : When I am deploying an executable using a sqC code that make direct connectivity with DB2(without using the above library libSTDbConnection.so) , it is running successfully on both the boxes. It seems there is some mistake I made while compiling the library. Any executable linked with libSTDbConnection.so library is giving me the same error(818).

mustaccio
  • 18,234
  • 16
  • 48
  • 57
chetan
  • 1,385
  • 4
  • 15
  • 31
  • SQL0818N means there's a version mismatch between the bound package and the binary that corresponds to it. If I understand your intent correctly, you need to copy libSTDbConnection.so along with the executable, because it's the shared library that's bound to the database, not the executable itself. – mustaccio Jun 16 '17 at 17:35
  • thanks mustaccio for the reply. libSTDbConnection.so library has also been copied along with the executable on the server. – chetan Jun 17 '17 at 07:01

0 Answers0