Results 1 to 1 of 1

Thread: [Paradox] Connecting QT to Paradox Database

  1. #1
    Join Date
    May 2012
    Posts
    1
    Qt products
    Qt4
    Platforms
    Windows Maemo/MeeGo

    Default Re: [Paradox] Connecting QT to Paradox Database

    Hello!
    I'm learning QT for a few days and met a problem I can' solve for 2 days:/
    I'm writing the application that downloads data from another's application database (Paradox 7.0). But I can't connect to that any way...
    Here is my code:
    Qt Code:
    1. #include <QtCore/QCoreApplication>
    2. #include <QDebug>
    3. #include <QtSql/QtSql>
    4.  
    5. int main(int argc, char *argv[])
    6. {
    7. QCoreApplication a(argc, argv);
    8.  
    9. QSqlDatabase db = QSqlDatabase::addDatabase("QODBC");
    10. db.setDatabaseName("Provider=MSDASQL;Persist Security Info=False;Mode=Read;Extended Properties='DSN=Paradox;DBQ=C:\\Dane\\ST_RCP;DefaultDir=C:\\Dane\\ST_RCP;DriverId=538;FIL=Paradox 7.X;MaxBufferSize=2048;PageTimeout=600;';Initial Catalog=C:\\Dane\\ST_RCP;");
    11. if(db.open())
    12. qDebug() << "Polaczenie z baza powiodlo sie";
    13. else
    14. qDebug() <<"Error: " << db.lastError ();
    15. return a.exec();
    16. }
    To copy to clipboard, switch view to plain text mode 
    Here is my error(In applications console)
    Error: QSqlError<0, "QODBC3: Unable to connect", "[Microsoft][Menedzer sterowników ODBC] Nie można odnaleźć źródła danych, a nie ma podanego sterownika domyślnego">
    Last part can be translated as "[Microsoft][ODBC drivers manager] Could not found data source, and there is not default value (given?)"

    What can I do with that? Any usefull informations? I tried to use http://qt-project.org/doc/qt-4.8/qtsql.html but nothing helped;/

    PS. This is sample code I wrote to learn connecting to database, not the one I wrote about in the beggining :P

    Paradox 7.0, Windows 7(64bit), QT Creator 2.4.1, QT 4.7.4(32 bit)
    plugins/sqldrivers <- done


    Added after 35 minutes:


    Problem Solved:
    Qt Code:
    1. QSqlDatabase db = QSqlDatabase::addDatabase("QODBC");
    2. db.setDatabaseName("Paradox");
    3. db.setUserName("Zellus");
    4. db.setHostName("Paradox");
    5. if(db.open())
    6. qDebug() << "Success";
    7. else
    8. qDebug() <<"Error: " << db.lastError ();
    To copy to clipboard, switch view to plain text mode 
    Also you have to C://Windows/sysWOW64/odbcad32.exe run
    and then Add>Driver to MS Paradox(*.db) (or other *.db, not sure what i did:P) Name Paradox, disable use default catalog, choose catalog and navigate to folder where database is ;]
    Last edited by Zellus; 24th May 2012 at 16:30.

Similar Threads

  1. Error connecting to Oracle database
    By NAYZAKAY44 in forum Qt Programming
    Replies: 1
    Last Post: 2nd August 2013, 18:20
  2. Replies: 2
    Last Post: 18th November 2009, 23:14
  3. Problem connecting to remote database
    By graciano in forum Qt Programming
    Replies: 2
    Last Post: 16th April 2009, 10:59
  4. Connecting to my database
    By miguel_mark in forum Qt Programming
    Replies: 6
    Last Post: 22nd October 2007, 09:50
  5. connecting QT3 with MS Access database
    By raghvendramisra in forum Qt Programming
    Replies: 1
    Last Post: 2nd February 2007, 09:48

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