0

I'm trying to connect my QT application to the Oracle database I have installed Oracle 11g and Oracle instant client 19.9. I configured my data source in a way that I believe is correct I added my env variable to the PATH

odbc 32 configuration:
odbc 32 configuration

and here's my coode function

bool db_connection::connect(){
    bool test=false;
    QSqlDatabase db = QSqlDatabase::addDatabase("QODBC");
    db.setDatabaseName("projetQT");
    db.setUserName("admin");//inserer nom de l'utilisateur
    db.setPassword("****");//inserer mot de passe de cet utilisateur


    if (db.open())
    test=true;

    else
           qDebug()<<db.lastError().text();
           qDebug() << "Connexion FAILED.";
           qDebug() << "Driver disponible: " << db.drivers();
           qDebug() << "Driver fonctionnel(QODBC): " << db.isDriverAvailable("QODBC");
           qDebug() << "database erreur: " << db.lastError().databaseText();
           qDebug() << "driver erreur: " << db.lastError().driverText();
           qDebug() << "type erreur: " << db.lastError().type();



        return  test;
}

And I get the error " The specified DSN contains an architecture mismatch between the Driver and Application QODBC3: Unable to connect" does anyone have a solution for me?

eyllanesc
  • 235,170
  • 19
  • 170
  • 241
nermineslimane
  • 541
  • 4
  • 21

1 Answers1

0

The Microsoft ODBC for Oracle driver is deprecated for ages, is does not work anymore with Oracle client 18 or newer.

Use the Oracle ODBC driver, e.g. Instant Client Downloads for Microsoft Windows (x64) 64-bit or Instant Client Downloads for Microsoft Windows 32-bit

enter image description here

Christopher Jones
  • 9,449
  • 3
  • 24
  • 48
Wernfried Domscheit
  • 54,457
  • 9
  • 76
  • 110
  • hat's exactly what I am using , i installed the instant client 19.9 . how do you suggest i implement the code on QT ? – nermineslimane Dec 20 '20 at 13:19
  • I am not talking about the Oracle Client, you have to use the ODBC driver from Oracle, not the Microsoft one. See difference in added screenshot. Maybe this one helps also: https://stackoverflow.com/questions/34803106/how-to-connect-to-oracle-11-database-from-net/34805999#34805999 – Wernfried Domscheit Dec 20 '20 at 16:25