jjaja nevermind I just founded the myodbc on the fedora website :P

but now it throwsme a segment violation :S:S:S

is this code right?:

Qt Code:
  1. QSqlDatabase *defaultDB;
  2. bool creaConexion()
  3. {
  4.  
  5. defaultDB = QSqlDatabase::addDatabase( DBDRIVER );
  6. defaultDB->setHostName( DB_HOSTNAME );
  7. defaultDB->setDatabaseName( "DRIVER={MySQL};Server="+DB_HOSTNAME+";Database="+DB_NOM+";Uid= "+DB_USR+";Pwd="+DB_PASS+";" );
  8. defaultDB->setUserName( DB_USR );
  9. defaultDB->setPassword( DB_PASS );
  10.  
  11. if ( ! defaultDB->open() ) {
  12. QMessageBox::warning(0, "Fallo de conexión", "No se pudo conectar con la base de datos: " + DB_NOM + "tabla: " + DB_TABLA + "\n" + defaultDB->lastError().driverText());
  13. return FALSE;
  14. }
  15. QMessageBox::information(0,"Conexión estabecida","Conectado a: " + DB_HOSTNAME + " " + "tabla: " + DB_TABLA + " "+ DB_NOM);
  16. return TRUE;
  17. }
To copy to clipboard, switch view to plain text mode