M
M
Matweytt2020-04-22 15:54:58
Qt
Matweytt, 2020-04-22 15:54:58

How to download QODBC driver?

QSqlDatabase: QODBC driver not loaded
QSqlDatabase: available drivers:

Very strange things happen, then it loads the QODBC driver, then it doesn’t load it, it’s not QSQLITE and nothing else

version of qt Qt 5.14.2
build cmake

you create such a project:

cmake_minimum_required(VERSION 3.5)

project(untitled LANGUAGES CXX)

set(CMAKE_INCLUDE_CURRENT_DIR ON)

set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(Qt5
COMPONENTS
    Core
    Sql
REQUIRED)

add_executable(untitled
  main.cpp
)
target_link_libraries(untitled Qt5::Core Qt5::Sql)

#include <QCoreApplication>
#include <QSql>
#include <QSqlDatabase>

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);
    QSqlDatabase bd = QSqlDatabase::addDatabase("QODBC");
    return a.exec();
}


Everything works, but if you suddenly open the same project only a little more and there is the same connection to the database, then it will be eternal:
QSqlDatabase: QODBC driver not loaded
QSqlDatabase: available drivers
, even if you remove everything unnecessary from this project so that only the code above remains won't work either, what could be the problem? where to dig? what to search?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question