Results 1 to 2 of 2

Thread: problem while executing Query

  1. #1
    Join Date
    Sep 2007
    Posts
    83
    Thanks
    6
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default problem while executing Query

    I am using QT commercial edition and i installed my OCI driver to access ORACLE db.
    Qt Code:
    1. static int cCount = 0;
    2.  
    3.  
    4. QSqlError err;
    5. QSqlDatabase db = QSqlDatabase::addDatabase(driver, QString("Connection%1").arg(++cCount));
    6. //db.setDatabaseName(dbName);
    7. db.setHostName(host);
    8. db.setPort(port);
    9. if (!db.open(user, passwd)) {
    10. err = db.lastError();
    11. db = QSqlDatabase();
    12. QSqlDatabase::removeDatabase(QString("Connection%1").arg(cCount));
    13. }
    14. else{
    15. conName.append(QString::number(cCount,10));
    16. QSqlQuery query;
    17. query.prepare("INSERT INTO person (id, forename, surname) "
    18. "VALUES (:id, :forename, :surname)");
    19. query.bindValue(":id", 10);
    20. query.bindValue(":forename", "Bart");
    21. query.bindValue(":surname", "Simpson");
    22. if(!query.exec())//;
    23. {
    24. QSqlError err1=query.lastError();
    25. QMessageBox::information(this,"Hi",err1.text());
    26. }
    To copy to clipboard, switch view to plain text mode 
    This is the method am using to create connection with my Db and immediately executing the sql query.Using above method i am able to connect with oracle Db with OCI driver and while executing sql query i am receiving error,which states that "Driver not loaded Driver not loaded".

    what is the problem? can any one help me....

    thanks

  2. #2
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: problem while executing Query

    open sqlbrowser which is located on QTDIR/demos/sqlbrowser and check if OCI driver is present and if is it then try to connect to a database using this tool. in that case if OCI driver is not present then you have to build it, read this how to do this.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

Similar Threads

  1. Facing problem with tool bar icons
    By jnana in forum Qt Programming
    Replies: 4
    Last Post: 20th April 2006, 08:37
  2. Problem with bitBlt
    By yellowmat in forum Newbie
    Replies: 1
    Last Post: 5th April 2006, 14:08
  3. fftw problem
    By lordy in forum General Programming
    Replies: 1
    Last Post: 16th March 2006, 21:36
  4. Replies: 16
    Last Post: 7th March 2006, 15:57
  5. Record update windowd entered data saving
    By MarkoSan in forum Qt Programming
    Replies: 56
    Last Post: 18th January 2006, 18:50

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.