Results 1 to 3 of 3

Thread: QODBC Driver not loaded after successfull connection and query

  1. #1
    Join Date
    Apr 2012
    Location
    Vienna, Austria
    Posts
    17
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Question QODBC Driver not loaded after successfull connection and query

    Hello everbody,

    i have a strange situation/behaviour with the QODBC driver.

    I've deployed the application with all the release-libraries (Windows 7 x32).
    When i do a simple QSqlDatabase connect with the QODBC driver, everything works well, including a QSqlQuery task.

    Qt Code:
    1. QSqlDatabase myDb = QSqlDatabase::addDatabase("QODBC", "myDb123");
    2. myDb.setDatabaseName("my odbc connection string");
    3. if (!myDb.open()) {
    4. qDebug() << myDb.lastError().text();
    5. }
    6. // do query and other funny things like int omg = 12/0;
    To copy to clipboard, switch view to plain text mode 

    But .. when i do the exact same thing a second time at runtime, i get a "DRIVER NOT LOADED. DRIVER NOT LOADED." error.

    When i restart the application i get the excat behaviour again: SUCCESS; then FAIL; FAIL; FAIL...

    To be honest i dont really know how to isolate the problem.
    Anyone has an idea why this might occur?

  2. #2
    Join Date
    Feb 2012
    Location
    Warsaw, Poland
    Posts
    37
    Thanks
    3
    Thanked 6 Times in 6 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: QODBC Driver not loaded after successfull connection and query

    Try this:
    Qt Code:
    1. if ( ! db.isOpen() )
    2. {
    3. if ( ! db.open() )
    4. {
    5. qWarning();
    6. }
    7. }
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Apr 2012
    Location
    Vienna, Austria
    Posts
    17
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: QODBC Driver not loaded after successfull connection and query

    Thank you for your answer,
    but nevermind... i found the problem.
    The second QSqlDatabase instance was created with the same **** connectionName.
    I have no idea how this could result in an error like "Driver not loaded" but hey it's working now.'
    yay!

Similar Threads

  1. Please, Urgent help needed: QODBC available but not loaded.
    By Mythical_Man in forum Qt Programming
    Replies: 1
    Last Post: 14th March 2012, 07:50
  2. QSqlDatabase: QODBC driver not loaded
    By sattu in forum Qt Programming
    Replies: 1
    Last Post: 22nd January 2011, 11:40
  3. QSqlDatabase: QODBC driver not loaded
    By gutiory in forum Qt Programming
    Replies: 1
    Last Post: 14th April 2010, 09:24
  4. QODBC driver not loaded error
    By Askar in forum Qt Programming
    Replies: 0
    Last Post: 23rd October 2009, 10:35
  5. qodbc driver not loaded error in release mode
    By mandal in forum Qt Programming
    Replies: 1
    Last Post: 14th November 2006, 09:42

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.