title: Qt SQL - Configuring Connection to Database
body: <p>I have given up on trying to configure the MYSQL driver for the Qt 5.0 library, I am going to use the only driver currently available to me - "QSQLITE".</p>
  
  <p>I have been trying to get this working for quite some time and have tried everything mentioned in similar posts:
  <a href="https://stackoverflow.com/questions/2311218/select-from-sqlite-with-qt">Select from SQLite with Qt</a></p>
  
  <pre><code>QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
  db.setHostName(SQL_SERVER);
  db.setPort(SQL_PORT);
  db.setDatabaseName(SQL_DATABASE);
  db.setUserName(SQL_USER);
  db.setPassword(SQL_PASS);
  bool dbSuccess = db.open();
  QList&lt;QString&gt; deviceNames;
  QString deviceName;
  qDebug() &lt;&lt; db;
  if(dbSuccess){
      QSqlQuery query;
      qWarning("We made it into the DB");
      query.exec("SELECT device_name FROM tbl_device");
      while (query.next() ){
          qDebug() &lt;&lt; query.value(1).toString();
         // deviceNames.append(deviceName);
          //qDebug() &lt;&lt; "Test: "&lt;&lt; deviceName;
      }
  }
  else if(!db.open()){
      qWarning("Database failed to load!");
  }
  </code></pre>
  
  <p>Where SQL_Server = 192.168.1.100</p>
  
  <p>I get the following qDebug output from the application:</p>
  
  <pre><code>QSqlDatabase(driver=""QSQLITE"", database=""homelogic"", host=""hendrenserver"", port=3306, user=""homelogic"",      open=true) 
  We made it into the DB
  </code></pre>
  
  <p>The output suggests that the database connection is valid, however if I change the servername to something completely false such as "xlkcjox" or other random keys - I get the same output. What am I missing here? I feel like this should be relatively easy. </p>
  
  <p>Please advise!</p>