Answer the question
In order to leave comments, you need to log in
How to set up a database driver on QT creator?
Good day to all! Can you suggest steps to solve the problem with the database drivers on QT?
I have already reviewed a bunch of videos, tried all the instructions, but this "shaitan machine" always gives out "Driver not loaded".
main.cpp:
Why does it say that drivers are available, but at the same time that drivers are not loaded?
QSqlDatabase: QSQLite driver not loaded
QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7
"Driver not loaded Driver not loaded"
Answer the question
In order to leave comments, you need to log in
For sqlite, you do not need to compile or put anything, everything should work out of the box.
db_ = QSqlDatabase::addDatabase("QSQLITE");
db_.setDatabaseName("mydatabase.db");
// db_.setConnectOptions("QSQLITE_OPEN_READONLY"); // Если нужно открыть в Read-only
db_.open();
// QSqlQuery q(db_);
// q.exec("PRAGMA foreign_keys = ON"); // Если нужны Foreign keys
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question