QSqldatabase db2 on ubuntu



  • 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


  • Lifetime Qt Champion

    Hi and welcome to devnet,

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



  • 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


  • Lifetime Qt Champion

    You can use packages.ubuntu.com for that



  • 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


  • Lifetime Qt Champion

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



  • 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



  • 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


Log in to reply
 

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