Hi guys a have a very simple question.
Facts are:
I use the OCI driver to connect to my local Oracle database. Everything works fine, I can update, insert delete without any problems.

Problem is:
Everytime I exec/show a new Widget or Dialog I need to reopen my database connection, even though when I create it, the compiler tells me an old connection has been removed. I`ve tried passing the database point, mem direction (&) and creating a new class the initialices the db but nothing seems to work except opening the connection before I initialize the model. I think that the main problem is the QSqlQuery because if I use a simple QSqlquery i can pass the database as a constructor parameter. Sorry for my poor explanation.

Qt Code:
  1. db = QSqlDatabase::addDatabase ("QOCI");
  2. db.setDatabaseName("XE");
  3. db.setUserName("xxxxx");
  4. db.setPassword("xxxxxx");
  5. db.setHostName("127.0.0.1");
  6. db.setPort(1521);
  7. if(db.open ()){
  8. model = new QSqlQueryModel ();
To copy to clipboard, switch view to plain text mode 

Thank you all in advance.

PS: Another quick question. Is there a way to call a program to execute before I open my app? Because I want to execute the oracle .bat: StartDB.bat so that the user doesn`t have to do it manually. I know that it starts when the system boots but sometimes for performance of the machine I need to close it for example....