配置说明

首先,需要已经安装Qt,且配置unvdb数据库。由于sqlunvdb驱动对unvdb数据库有依赖,最好将unvdb目录下的lib库加入至环境变量中。

将对应Qt版本的sqlunvdb驱动解压后,把驱动动态库文件放在Qt安装目录下的插件目录的sqldrivers文件夹下,如"D:\Qt\Qt5.9.0\5.9\msvc2013_64\plugins\sqldrivers"或"/usr/local/Qt-5.9.0/plugins/sqldrivers"

如果不确定路径,可以编写以下程序然后使用Qt编译执行:

// main.cpp
#include <QCoreApplication>
#include <QSqlDatabase>
#include <QtDebug>
int main(int argc, char *argv[]) {
    QCoreApplication a(argc, argv);
    qDebug() << "The driver should be put in this path:" << QCoreApplication::libraryPaths();
    qDebug() << "Available drivers:" << QSqlDatabase::drivers();
    return a.exec();
}

如果已经放入正确的路径且无依赖问题,可以看到可用驱动列表中有unvdb.

The driver should be put in this path: ("/root/workspace/qt/install/plugins", "/root/workspace/qt/test") 
Available drivers: ("QSQLite", "QUNVDB")