Results 1 to 8 of 8

Thread: Deploying QT App using ODBC driver

  1. #1
    Join Date
    Aug 2008
    Posts
    38
    Thanks
    15
    Qt products
    Qt4
    Platforms
    Windows

    Question Deploying QT App using ODBC driver

    QT Creator 2.2.1 - compile with mingw
    QT 4.7.3
    Windows 7 32 bit

    Hello,
    I have a simple start at a qt application which access a MSSQL server via the ODBC driver. The application compiles and runs fine in both debug and release versions when the dlls are in the same directory on my computer (development machine). When I zip all the files together and send to another non-dev machine it does not work, it errors out with: "Cannot load database driver", which tells me that the QODBC is not "found?"... The files I am including in the release version are:
    icons (folder)
    libgcc_s_dw2-1.dll
    libQtSql4.a
    mingwm10.dll
    QtCore4.dll
    QtGui4.dll
    qtmsSQL.exe (App)
    QtSql4.dll

    I cannot attach the dependancy walker file for info, but the highlights are this: (ran on dev machine)
    It shows under the exe: kernel32.dll, mignwm10.dll, msvcrt.dll, (shortcut)msvcrt.dll, libgcc_s_dw2-1.dll, qtcore4.dll, qtgui4.dll, qtsql4.dll.
    in Module breakdown...
    There is an hourglass symbol + yellow questionmark by IESHIMS.dll ("Error opening file. System cannot find the file specified (2).")
    There is a red box by SHLWAPI.dll - no other info noteworthy to me anyway...
    There is an hourglass symbol + red box by IEFRAME.dll - no other info noteworthy to me anyway...

    In comment window the following:
    Warning: At least one delay-load dependency module was not found.
    Warning: At least one module has an unresolved import due to a missing export function in a delay-load dependent module.

    I am unclear as to how to use dependancy walker, should it be run on the dev machine or on the machine with issues... What does it mean when they are red?
    Anyway, in case I am missing something in my pro file, it is attached for reference:
    Qt Code:
    1. # -------------------------------------------------
    2. # Project created by QtCreator 2010-03-25T20:08:06
    3. # -------------------------------------------------
    4. QT += sql
    5. TARGET = qtmsSQL
    6. TEMPLATE = app
    7. SOURCES += main.cpp \
    8. dialog.cpp \
    9. ../qtWidgets/recordNav/dbrecordnav.cpp \
    10. employeeform.cpp
    11. HEADERS += dialog.h \
    12. ../qtWidgets/recordNav/dbrecordnav.h \
    13. employeeform.h
    To copy to clipboard, switch view to plain text mode 

    Finally, sorry if this is super easy, I am just confused. When I have deployed other QT Apps all that I needed was to make sure the correct dlls (QtCore/QtGui/mingw) were in the exe directory and it all worked well. Hope someone can (and will) shed some light on this issue!
    Thanks,
    Alphawolfxv

  2. #2
    Join Date
    Aug 2009
    Location
    Belgium
    Posts
    310
    Thanks
    10
    Thanked 31 Times in 25 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Deploying QT App using ODBC driver

    You should run depends.exe on the non-dev machine, not the dev machine.

    Do you use the pre-build MingW version of Qt or did you build Qt yourself ? In the latter case : did you build as a plugin or as part of libqt ?

    Regards,
    Marc

  3. #3
    Join Date
    Aug 2008
    Posts
    38
    Thanks
    15
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Deploying QT App using ODBC driver

    marcvanriet,
    Thank you for the response. I had just downloaded the QtSDK installer from qt-creator.com (nokia) as the online installer file and ran it. Could this be the problem, how would I go about compiling qt on my own? I vaguely remember from Qt Creator 0.x and early qt versions where it was a arduous process to compile qt; is this what I should have done for install?
    Thanks again for your help,
    AlphaWolfXV

    Also, as a side update both dependancy checker and dependancy walker show no failures now. I copied over the ieshims.dll from the program files/internet explorer and the yellow missing file went away. This is running on both dev and clean machines.

    I also added the following to the exe structure:
    <folder>:
    x.exe
    qtcore4.dll
    qtgui4.dll
    mingwm10.dll
    libgcc_s_dw2-1.dll
    <folder>/icons: misc icons
    <folder>/plugins/sqldrivers:
    qsqlodbc.dll (from QtSDK/desktop/qt/4.7.3/mingw/plugins/sqldrivers/)

    then I added to main:
    Qt Code:
    1. a.addLibraryPath(a.applicationDirPath() + "/plugins/sqldrivers"); //ADDED THIS LINE WHERE A IS QApplication a(argc,argv)
    To copy to clipboard, switch view to plain text mode 
    But it still gives me the Driver not Loaded error on the clean machine.
    Thanks again,
    Alphawolfxv

  4. #4
    Join Date
    Aug 2009
    Location
    Belgium
    Posts
    310
    Thanks
    10
    Thanked 31 Times in 25 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Deploying QT App using ODBC driver

    About building Qt : I just asked because with the prebuild (or if you build it yourself with odbc as plugin), then you have to copy the odbc dll to the non-dev machine, which you didn't do at first, but you did it now appearantly. There is no need to build Qt yourself. And building it is no big deal nowadays, except that it takes a long time.

    You can also try and copy the obdc dll directly in the folder of the .exe instead of under /plugins/... You don't need to do the 'addLibraryPath', because the program automatically searches in some pre-defined subdirectories (it's in the docs somewhere).

    Other than that, I can't be of much help I'm afraid.

    Best regards,
    Marc

  5. The following user says thank you to marcvanriet for this useful post:

    AlphaWolfXV (16th December 2011)

  6. #5
    Join Date
    Aug 2008
    Posts
    38
    Thanks
    15
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Deploying QT App using ODBC driver

    Thank you for your help, I will keep trying. One other question, do you think I should have to install MSSQLEXPRESS on the clean computer to "load" the driver?
    Thanks,
    AlphaWolfXV

  7. #6
    Join Date
    Aug 2009
    Location
    Belgium
    Posts
    310
    Thanks
    10
    Thanked 31 Times in 25 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Deploying QT App using ODBC driver

    MSSQLEXPRESS ? Never heard of that, so no, you don't need it.

  8. #7
    Join Date
    Aug 2008
    Posts
    38
    Thanks
    15
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Deploying QT App using ODBC driver

    Ok, I understand. I wasn't sure if I should load MSSQL on the clean machine. Thanks again!
    Cyrus

  9. #8
    Join Date
    Dec 2014
    Posts
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Deploying QT App using ODBC driver

    Hello fellow AlphaWolfXV, as has happened to me many days ago, and yesterday I found the solution, you must first find the folder on your development machine that has sqldrivers "plugins/sqldrivers", copy the directory sqldrivers only in the directory where your have x.exe, plus all dlls you have on it and sqldrivers like this, this solution worked for me, sorry my english, its not my native language... I hope it help you

    <folder>:
    x.exe
    qtcore4.dll
    qtgui4.dll
    mingwm10.dll
    libgcc_s_dw2-1.dll
    ...
    <folder>/sqldrivers:
    qsqlodbc.dll (from dir/plugins/sqldrivers/)
    ...

  10. The following user says thank you to raynosc for this useful post:

    iskenderoguz (5th January 2016)

Similar Threads

  1. Slow ODBC driver or programming error?
    By TorAn in forum Qt Programming
    Replies: 9
    Last Post: 13th November 2011, 23:31
  2. Help with QMYSQL driver for QT 4.4.0: driver not loaded
    By khikho in forum Installation and Deployment
    Replies: 4
    Last Post: 1st April 2011, 16:00
  3. source code for odbc driver or MySql driver in arm-embedded-linux
    By sattu in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 24th January 2011, 11:11
  4. Custom gfx driver(subdriver) with Transformed gfx driver - is this possible?
    By slscripters in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 24th June 2010, 11:25
  5. Deploying debug Qt application - failed to load ODBC driver
    By sureshbabu in forum Installation and Deployment
    Replies: 1
    Last Post: 1st November 2007, 13:35

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.