July 28, 2012

Sibyx Sibyx
Lab Rat
17 posts

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:

  1. IBMConn::IBMConn(QString host, QString port, QString user, QString password, QString database)
  2. {
  3.     conn = QSqlDatabase::addDatabase("QDB2");
  4.     conn.setHostName(host);
  5.     conn.setDatabaseName(database);
  6.     conn.setUserName(user);
  7.     conn.setPassword(password);
  8.     if (!port.isNull()) {
  9.         conn.setPort(port.toInt());
  10.     }
  11.     if (!conn.open()) {
  12.         appLogger->Log(Logger::LOG_DRIVER,QString("Error: %1").arg(conn.lastError().text()));
  13.     }
  14.     else {
  15.         appLogger->Log(Logger::LOG_DRIVER, "IBM DB2 driver inicialized");
  16.         appLogger->Log(Logger::LOG_DRIVER, "Connected to " + host);
  17.     }
  18. }

In this project I use msvc 2010 compiler (same as before) and when I run my app, output is:
  1. QSqlDatabase: QDB2 driver not loaded
  2. QSqlDatabase: available drivers: QIBASE QSQLITE QMYSQL3 QMYSQL QOCI8 QOCI QODBC3 QODBC

I don’t understand why my plugin isn’t loaded.

4 replies

July 29, 2012

Hostel Hostel
Lab Rat
171 posts

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.

July 29, 2012

Sibyx Sibyx
Lab Rat
17 posts

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:
    1. Starting C:\Users\magia\Qt\DatabaseExporter\debug\DatabaseExporter.exe...
    2. QDB2Driver::open: Unable to allocate environment Error:  
    3. C:\Users\magia\Qt\DatabaseExporter\debug\DatabaseExporter.exe exited with code 0

July 29, 2012

Hostel Hostel
Lab Rat
171 posts

  1. 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:

  1. db2app.dll
  2. db2cli.dll
  3. db2dascmn.dll
  4. db2g11n.dll
  5. db2genreg.dll
  6. db2install.dll
  7. db2licm.dll
  8. db2locale.dll
  9. db2osse.dll
  10. db2osse_db3.dll
  11. db2sdbin.dll
  12. db2sys.dll
  13. db2trcapi.dll
  14. db2wint.dll
  15. gpsvc.dll
  16. IEShims.dll
  17. sysntfy.dll

July 31, 2012

Sibyx Sibyx
Lab Rat
17 posts

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

 
  ‹‹ Developping an HTML5 & jQuery Visual Editor      How to search in a text and take the first match? ››

You must log in to post a reply. Not a member yet? Register here!