[solved] DB2 driver



  • I'm on Ubuntu 32bits.
    Qt 5.1.1
    I installed with online installer in /opt/Qt (I created /opt/Qt before with writing perms for my user).
    I installed from my user (not with root).

    DB2 Client is installed on this machine and I can access my DB2 Database from DB2 CLI.

    Db2 folder is:
    /opt/ibm/db2/V10.5

    I follow instructions on this page:
    http://qt-project.org/doc/qt-4.8/sql-driver.html#qdb2

    I do this command:
    @
    /opt/Qt/5.1.1/Src/qtbase/src/plugins/sqldrivers/db2$ qmake "INCLUDEPATH+=$DB2DIR/include" "LIBS+=-L$DB2DIR/lib32 -ldb2"
    @
    Note that I modify to point to lib32 folder because lib folder doesn't exist. In this folder I have some .so files.
    Also note that I had to go in folder "qtbase" instead of the one on the website because the path on the website doesn't exist.

    I have this message:
    @
    /opt/Qt/5.1.1/Src/qtbase/mkspecs/features/qt_functions.prf:184: resolve_depends(var, prefix) requires one or two arguments.
    /opt/Qt/5.1.1/Src/qtbase/mkspecs/features/qt_functions.prf:250: resolve_depends(var, prefix) requires one or two arguments.
    /opt/Qt/5.1.1/Src/qtbase/mkspecs/features/qt_functions.prf:250: resolve_depends(var, prefix) requires one or two arguments.
    /opt/Qt/5.1.1/Src/qtbase/mkspecs/features/qt_functions.prf:250: resolve_depends(var, prefix) requires one or two arguments.
    /opt/Qt/5.1.1/Src/qtbase/mkspecs/features/qt_functions.prf:250: resolve_depends(var, prefix) requires one or two arguments.
    @

    I can't go further ... I can't make... I have errors too.

    @
    $ make
    /usr/lib/i386-linux-gnu/qt5/bin/moc -DQ_USE_APPMENU -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB -I../../../../mkspecs/linux-g++ -I. -I/opt/ibm/db2/V10.5/include -I/usr/include/qt5 -I/usr/include/qt5/QtSql -I/usr/include/qt5/QtSql/5.0.1 -I/usr/include/qt5/QtSql/5.0.1/QtSql -I/usr/include/qt5/QtCore -I/usr/include/qt5/QtCore/5.0.1 -I/usr/include/qt5/QtCore/5.0.1/QtCore -I.moc/release-shared -I/usr/include -I/usr/include/c++/4.7 -I/usr/include/c++/4.7/backward -I/usr/include/i386-linux-gnu -I/usr/include/i386-linux-gnu/c++/4.7/. -I/usr/lib/gcc/i686-linux-gnu/4.7/include -I/usr/lib/gcc/i686-linux-gnu/4.7/include-fixed -I/usr/local/include main.cpp -o .moc/release-shared/main.moc
    g++ -c -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -O2 -fvisibility=hidden -fvisibility-inlines-hidden -std=c++0x -fno-exceptions -O2 -Wall -W -D_REENTRANT -fPIC -DQ_USE_APPMENU -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB -I../../../../mkspecs/linux-g++ -I. -I/opt/ibm/db2/V10.5/include -I/usr/include/qt5 -I/usr/include/qt5/QtSql -I/usr/include/qt5/QtSql/5.0.1 -I/usr/include/qt5/QtSql/5.0.1/QtSql -I/usr/include/qt5/QtCore -I/usr/include/qt5/QtCore/5.0.1 -I/usr/include/qt5/QtCore/5.0.1/QtCore -I.moc/release-shared -o .obj/release-shared/main.o main.cpp
    g++ -c -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -O2 -fvisibility=hidden -fvisibility-inlines-hidden -std=c++0x -fno-exceptions -O2 -Wall -W -D_REENTRANT -fPIC -DQ_USE_APPMENU -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB -I../../../../mkspecs/linux-g++ -I. -I/opt/ibm/db2/V10.5/include -I/usr/include/qt5 -I/usr/include/qt5/QtSql -I/usr/include/qt5/QtSql/5.0.1 -I/usr/include/qt5/QtSql/5.0.1/QtSql -I/usr/include/qt5/QtCore -I/usr/include/qt5/QtCore/5.0.1 -I/usr/include/qt5/QtCore/5.0.1/QtCore -I.moc/release-shared -o .obj/release-shared/qsql_db2.o ../../../sql/drivers/db2/qsql_db2.cpp
    ../../../sql/drivers/db2/qsql_db2.cpp:43:40: fatal error: QtSql/private/qsqldriver_p.h: No such file or directory
    compilation terminated.
    make: *** [.obj/release-shared/qsql_db2.o] Error 1
    @

    I would like to be able to access my DB2 remote database from my Qt App... How ?



  • Now it's working.

    I uninstall all Qt and all Qt versions on my linux box. There was a mix of .deb package and .tar.gz package... and version 4 with 5.0.1 and 5.1.1... etc.

    I reinstall all with .tar.gz

    Also I had to ldconfig some .so of db2 and adjust include in the command, symink qmake to be the version of Qt (not the .deb one) and symlink about lib32/lib of db2 and plugins.

    It's working, I have access to DB2 remote server with Qt.

    I'v done it with Linux 32bits DB2 client (full) version 10.5 and I access a DB2 8.2.8 server (also in linux).

    Anyway, documentation should be modify to have the right path of db2 (and others) sqldrivers.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.