Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. 3rd Party Software
  4. QSqldatabase db2 on ubuntu
QtWS25 Last Chance

QSqldatabase db2 on ubuntu

Scheduled Pinned Locked Moved 3rd Party Software
8 Posts 2 Posters 3.0k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    freekb
    wrote on last edited by
    #1

    Hi,

    I've created a qt program that tries to read a db2 database. The db2 database is located on an AS400 machine and the qt program runs on Ubuntu 12.04 64 bit. I'm running QT 4.8.0 64 bit. I've compiled the db2 driver against client library version 10.5 (v10.5fp2_linuxx64_client.tar.gz).
    I've installed the client library on the live machine and ran the program.

    --- The code looks as follows

        QSqlDatabase SqlDatabase = QSqlDatabase::addDatabase("QDB2","testdb2");
        SqlDatabase.setHostName(Hostname);
        SqlDatabase.setDatabaseName(Databasename);
        SqlDatabase.setUserName(UserName);
        SqlDatabase.setPassword(Password);
        SqlDatabase.open();
    

    The program throws the following line to stdout.
    ..../qt4/plugins/sqldrivers/libqsqldb2.so: undefined symbol: SQLAllocHandle

    Any idea what goes wrong?

    Thanks in advance,
    Freek

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      You are probably missing a library, run ldd on libqsqldb2.so to see which one it is

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • F Offline
        F Offline
        freekb
        wrote on last edited by
        #3

        Hi SGaist,

        Indeed I'm missing linux-vdso.so.1. All the other ones are there.

        So I need to find out what package it belongs to and install it.

        Thanks,

        Freek

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          You can use packages.ubuntu.com for that

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • F Offline
            F Offline
            freekb
            wrote on last edited by
            #5

            Hi SGaist,

            Thanks for that... I did already have a look, but the problem is I cannot find it there. Although the name of the file assumes it is an standard linux file, I think it might be an iBM file as well.

            Are you aware of any other IBM library rather than the client library that you need to install in order to run with the DB2 drivers?

            Thanks in advance,
            Freek

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Just to be sure, did you verify that all your libraries have the same architecture ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • F Offline
                F Offline
                freekb
                wrote on last edited by
                #7

                Sorry it takes so long... I've decided based on this remark to rebuild the db2plugin from scratch. And I do have a problem building it. I know I changed the qmake command compared to the instructions (http://qt-project.org/doc/qt-4.8/sql-driver.html), but I don't know how anymore...

                I will come back on this.

                Thanks,
                Freek

                1 Reply Last reply
                0
                • F Offline
                  F Offline
                  freekb
                  wrote on last edited by
                  #8

                  I think I know what went wrong... I did compile against the 4.8.5 source. Strange thing is... I'm already trying for over a day to get the db2 driver compiled against the qt 4.8.0 source and I don't get it to work anymore.

                  The errors I'm getting are:
                  ../../../sql/drivers/db2/qsql_db2.cpp: In member function ‘virtual QVariant QDB2Result::data(int)’:
                  ../../../sql/drivers/db2/qsql_db2.cpp:1033:77: error: call of overloaded ‘QVariant(SQLBIGINT)’ is ambiguous
                  ../../../sql/drivers/db2/qsql_db2.cpp:1033:77: note: candidates are:
                  /usr/include/qt4/QtCore/qvariant.h:432:12: note: QVariant::QVariant(const char*) <near match>
                  /usr/include/qt4/QtCore/qvariant.h:432:12: note: no known conversion for argument 1 from ‘SQLBIGINT {aka long int}’ to ‘const char*’
                  /usr/include/qt4/QtCore/qvariant.h:429:12: note: QVariant::QVariant(void*) <near match>
                  /usr/include/qt4/QtCore/qvariant.h:429:12: note: no known conversion for argument 1 from ‘SQLBIGINT {aka long int}’ to ‘void*’
                  /usr/include/qt4/QtCore/qvariant.h:219:5: note: QVariant::QVariant(Qt::GlobalColor) <near match>
                  /usr/include/qt4/QtCore/qvariant.h:219:5: note: no known conversion for argument 1 from ‘SQLBIGINT {aka long int}’ to ‘Qt::GlobalColor’
                  /usr/include/qt4/QtCore/qvariant.h:212:5: note: QVariant::QVariant(const QLocale&) <near match>
                  /usr/include/qt4/QtCore/qvariant.h:212:5: note: no known conversion for argument 1 from ‘SQLBIGINT {aka long int}’ to ‘const QLocale&’
                  /usr/include/qt4/QtCore/qvariant.h:194:5: note: QVariant::QVariant(const QChar&)
                  /usr/include/qt4/QtCore/qvariant.h:191:5: note: QVariant::QVariant(const QString&) <near match>
                  /usr/include/qt4/QtCore/qvariant.h:191:5: note: no known conversion for argument 1 from ‘SQLBIGINT {aka long int}’ to ‘const QString&’
                  /usr/include/qt4/QtCore/qvariant.h:189:5: note: QVariant::QVariant(const QByteArray&) <near match>
                  /usr/include/qt4/QtCore/qvariant.h:189:5: note: no known conversion for argument 1 from ‘SQLBIGINT {aka long int}’ to ‘const QByteArray&’
                  /usr/include/qt4/QtCore/qvariant.h:184:5: note: QVariant::QVariant(float)
                  /usr/include/qt4/QtCore/qvariant.h:183:5: note: QVariant::QVariant(double)
                  /usr/include/qt4/QtCore/qvariant.h:182:5: note: QVariant::QVariant(bool)
                  /usr/include/qt4/QtCore/qvariant.h:181:5: note: QVariant::QVariant(qulonglong)
                  /usr/include/qt4/QtCore/qvariant.h:180:5: note: QVariant::QVariant(qlonglong)
                  /usr/include/qt4/QtCore/qvariant.h:179:5: note: QVariant::QVariant(uint)
                  /usr/include/qt4/QtCore/qvariant.h:178:5: note: QVariant::QVariant(int)
                  /usr/include/qt4/QtCore/qvariant.h:172:5: note: QVariant::QVariant(const QVariant&)
                  /usr/include/qt4/QtCore/qvariant.h:169:5: note: QVariant::QVariant(QVariant::Type) <near match>
                  /usr/include/qt4/QtCore/qvariant.h:169:5: note: no known conversion for argument 1 from ‘SQLBIGINT {aka long int}’ to ‘QVariant::Type’
                  ../../../sql/drivers/db2/qsql_db2.cpp: In member function ‘virtual bool QDB2Driver::open(const QString&, const QString&, const QString&, const QString&, int, const QString&)’:
                  ../../../sql/drivers/db2/qsql_db2.cpp:1213:79: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
                  ../../../sql/drivers/db2/qsql_db2.cpp:1216:81: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
                  ../../../sql/drivers/db2/qsql_db2.cpp: In member function ‘bool QDB2Driver::setAutoCommit(bool)’:
                  ../../../sql/drivers/db2/qsql_db2.cpp:1580:51: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
                  make: *** [qsql_db2.o] Error 1

                  Any clue?

                  Best regards and thanks in advance,
                  Freek

                  1 Reply Last reply
                  0

                  • Login

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved