Results 1 to 2 of 2

Thread: Mac OS + Qt 4.6.2, QODBC3: Unable to connect

  1. #1
    Join Date
    Jan 2006
    Posts
    18
    Thanks
    4
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Unhappy Mac OS + Qt 4.6.2, QODBC3: Unable to connect

    Hi,

    I am trying to get an ODBC connection working on my new macbook in Qt, but I am coming up with the following error.

    " QODBC3: Unable to connect"

    This is the small piece of test code I am using:

    Qt Code:
    1. #include <QCoreApplication>
    2. #include <QSqlDatabase>
    3. #include <QSqlError>
    4. #include <QDebug>
    5.  
    6. int main(int argc, char* argv[]) {
    7. QCoreApplication app(argc, argv);
    8. QSqlDatabase db = QSqlDatabase::addDatabase("QODBC3");
    9. // Also, try replacing the two previous lines with:
    10. // QSqlDatabase db = QSqlDatabase::addDatabase("QODBC3");
    11. // No need to set any version option in that case
    12. db.setDatabaseName("DRIVER=FreeTDS;SERVER=192.168.16.5;Port=1433;DATABASE=db_test;TDS_Version=8.0;uid=SomeUser;pwd=SomePassword");
    13. bool r = db.open();
    14. if (!r) {
    15. qDebug() << db.lastError().text();
    16. }
    17. else {
    18. qDebug() << "OK!";
    19. }
    20. }
    To copy to clipboard, switch view to plain text mode 

    Here are a couple of parts of the trace log.

    Qt Code:
    1. [000000.000302]
    2. test A0B4C4E0 ENTER SQLDriverConnect
    3. SQLHDBC 0xf19ff0
    4. SQLPOINTER 0x0
    5. SQLCHAR * 0xf1a080
    6. | DRIVER=FreeTDS;SERVER=192.168.16.5;Port= |
    7. | 1433;DATABASE=db_test;TDS_Ve |
    8. | rsion=8.0;uid=SomeUser;pwd=********* |
    9. SQLSMALLINT 119
    10. SQLCHAR * 0xbffff48c
    11. SQLSMALLINT 1024
    12. SQLSMALLINT * 0xbffff8ec
    13. SQLUSMALLINT 0 (SQL_DRIVER_NOPROMPT)
    14.  
    15. [000000.000722]
    16. test A0B4C4E0 EXIT SQLDriverConnect with return code -1 (SQL_ERROR)
    17. SQLHDBC 0xf19ff0
    18. SQLPOINTER 0x0
    19. SQLCHAR * 0xf1a080
    20. SQLSMALLINT 119
    21. SQLCHAR * 0xbffff48c
    22. SQLSMALLINT 1024
    23. SQLSMALLINT * 0xbffff8ec
    24. SQLUSMALLINT 0 (SQL_DRIVER_NOPROMPT)
    To copy to clipboard, switch view to plain text mode 

    Can anybody help me?

    Thanks,
    Royce

  2. #2
    Join Date
    Jan 2006
    Posts
    18
    Thanks
    4
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Mac OS + Qt 4.6.2, QODBC3: Unable to connect

    Ok this seems to be a bug in Qt 4.6.2, I have installed Qt 4.7.0-beta1 and it now seems to work.

    The tip off was this link.

    It should be fixed in Qt 4.6.3 when that is ready.

    Royce

Similar Threads

  1. Unable to install QCA
    By viv_asp in forum Installation and Deployment
    Replies: 2
    Last Post: 30th January 2011, 07:28
  2. Replies: 16
    Last Post: 16th February 2010, 13:17
  3. ODBC Oracle. Unable to connect to database
    By egil in forum Qt Programming
    Replies: 2
    Last Post: 17th October 2008, 13:46
  4. Replies: 4
    Last Post: 10th November 2006, 15:38
  5. Connectingto MySQL with QODBC3
    By Philip_Anselmo in forum Qt Programming
    Replies: 22
    Last Post: 9th June 2006, 16:03

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
  •  
Qt is a trademark of The Qt Company.