hi there;

I have a problem connecting to a sqlite 3.5.9 using QT 4.5 in a fedora 10 machine.
when i try the following code:
Qt Code:
  1. db = QSqlDatabase::addDatabase("QSQLITE");
  2. if (db.isValid())
  3. std::cout<<"db is valid!"<<endl;
  4. db.setHostName("localhost");
  5. db.setDatabaseName("feed");
  6. if (db.open()){
  7. std::cout<<"db opened"<<endl;
  8. cout<<"drivers are : "; // just to open all the available drivers
  9. QStringList r = QSqlDatabase::drivers();
  10. for (int i=0;i<r.size();i++)
  11. std::cout<<((QString)r.at(i)).toStdString()<<endl;
  12.  
  13. QString txt="select * from item_table";
  14. query.exec(txt);
  15. if (query.isValid() && query.isActive()){
  16. std::cout<<"query is valid and active"<<endl;
  17. }
  18. else{
  19. std::cout<<"in error: "<<query.lastError().text().toStdString()<<endl;
  20. }
To copy to clipboard, switch view to plain text mode 

the output of that code is:

Qt Code:
  1. db is valid!
  2. db opened
  3. drivers are : QSQLITE
  4. QSqlQuery::exec: database not open
  5. in error: Driver not loaded Driver not loaded
To copy to clipboard, switch view to plain text mode 

as you cabn see. both methods : db.isValid() and db.opn() return true. showing the available drivers using QSqlDatabase::drivers() prints QSQLITE

BUT when i try to execute the select statement - on the valid and existing table item_table - it throws to me :"QSqlQuery::exec: database not open"
and the query.lastError().text() prints : "Driver not loaded" twice

what am i missing here??? can anybody help Me PLS??