库文件
1、Qt源码目录:D:\Qt5\5.15.2\Src\qtbase\src\plugins\sqldrivers\oci
2、oracle客户端SDK: https://www.oracle.com/database/technologies/instant-client/winx64-64-downloads.html
下载各版本中的如下压缩包,一定要版本相同的
将两个压缩包解压并合并
打开并修改oci.pro
TARGET = qsqloci
HEADERS += $$PWD/qsql_oci_p.h
SOURCES += $$PWD/qsql_oci.cpp $$PWD/main.cpp
# QMAKE_USE += oci
QMAKE_LFLAGS +=D:\instantclient_21_13\sdk\lib\msvc\oci.lib
INCLUDEPATH +=D:\instantclient_21_13\sdk\include
LIBPATH += D:\instantclient_21_13\sdk\lib\msvc
darwin:QMAKE_LFLAGS += -Wl,-flat_namespace,-U,_environ
OTHER_FILES += oci.json
PLUGIN_CLASS_NAME = QOCIDriverPlugin
include(../qsqldriverbase.pri)
QMAKE_LFLAGS 、INCLUDEPATH 、LIBPATH ,请按照实际填写
执行构建
将生成的dll复制到:D:\Qt5\5.15.2\msvc2019_64\plugins\sqldrivers
然后将这两个动态库放入运行目录即可
编译好的dll下载地址:https://download.csdn.net/download/Python1996/89126231