QDB2 driver not loaded



  • Hi,
    I compiled driver for IBM DB2 with msvc 2010, binaries (qsqldb24.dll and qsqldb2d4.dll) I copied to C:\Development\QtSDK\Desktop\Qt\4.8.1\msvc2010\plugins\sqldrivers . Now I have application where I'm using QDB2 driver:
    @IBMConn::IBMConn(QString host, QString port, QString user, QString password, QString database)
    {
    conn = QSqlDatabase::addDatabase("QDB2");
    conn.setHostName(host);
    conn.setDatabaseName(database);
    conn.setUserName(user);
    conn.setPassword(password);
    if (!port.isNull()) {
    conn.setPort(port.toInt());
    }
    if (!conn.open()) {
    appLogger->Log(Logger::LOG_DRIVER,QString("Error: %1").arg(conn.lastError().text()));
    }
    else {
    appLogger->Log(Logger::LOG_DRIVER, "IBM DB2 driver inicialized");
    appLogger->Log(Logger::LOG_DRIVER, "Connected to " + host);
    }
    }@
    In this project I use msvc 2010 compiler (same as before) and when I run my app, output is:
    @QSqlDatabase: QDB2 driver not loaded
    QSqlDatabase: available drivers: QIBASE QSQLITE QMYSQL3 QMYSQL QOCI8 QOCI QODBC3 QODBC@
    I don't understand why my plugin isn't loaded.



  • I don't use DB2 but for example plugin for PostgreSQL requires a dll for connecting to db. Maybe your plugin can't load dll for db2. Use a Dependency Walker to check for missing dll for QDB2 plugin.



  • I use Depency Walker and I found these depencies:

    • db2app.dll
    • db2cli.dll
    • db2dascmn.dll
    • db2g11n.dll
    • db2genreg.dll
    • db2install.dll
    • db2licm.dll
    • db2locale.dll
    • db2osse.dll
    • db2osse_db3.dll
    • db2sdbin.dll
    • db2sys.dll
    • db2trcapi.dll
    • db2wint.dll
    • gpsvc.dll
    • IEShims.dll
    • sysntfy.dll
      Now, my driver is loaded but I have next problem:
      @Starting C:\Users\magia\Qt\DatabaseExporter\debug\DatabaseExporter.exe...
      QDB2Driver::open: Unable to allocate environment Error:
      C:\Users\magia\Qt\DatabaseExporter\debug\DatabaseExporter.exe exited with code 0@


  • @
    QDB2Driver::open: Unable to allocate environment
    @
    This warning is in db2 plugin source. Are you sure that connect data is correct? Check a values of host, port, password etc. Can you connect to db from other tool on this values?

    Maybe there are another dependencies in dlls - check all of dlls for another dependencies by Dependency Walker:
    @
    db2app.dll
    db2cli.dll
    db2dascmn.dll
    db2g11n.dll
    db2genreg.dll
    db2install.dll
    db2licm.dll
    db2locale.dll
    db2osse.dll
    db2osse_db3.dll
    db2sdbin.dll
    db2sys.dll
    db2trcapi.dll
    db2wint.dll
    gpsvc.dll
    IEShims.dll
    sysntfy.dll
    @



  • I check all dependecies and I check my connect data too. All is fine, I try to connect do DB localy etc. but without any success. I try other machines with installed DB2 or not, I disabled firewall too. I don't know where is mistake


Log in to reply
 

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