文章目录
前言
提示:qoci 驱动配置很简单,参考网上失败,最后参照qt官网成功!
一、安装QT、Oracle
这里就不赘述了,其他教程足够用
QT:5.12.1
ORACLE:19.3
二、生成qsqloci.dll
1.配置oci.pro
cd D:\Qt\Qt5.12.1\5.12.1\Src\qtbase\src\plugins\sqldrivers\oci
下面有oci.pro
修改内容如下
TARGET = qsqloci
HEADERS += $$PWD/qsql_oci_p.h
SOURCES += $$PWD/qsql_oci.cpp $$PWD/main.cpp
#QMAKE_USE += oci
QMAKE_LFLAGS +=D:\BaiduNetdiskDownload\WINDOWS.X64_193000_db_home\bin\oci.dll
darwin:QMAKE_LFLAGS += -Wl,-flat_namespace,-U,_environ
OTHER_FILES += oci.json
PLUGIN_CLASS_NAME = QOCIDriverPlugin
include(../qsqldriverbase.pri)
INCLUDEPATH += D:/BaiduNetdiskDownload/WINDOWS.X64_193000_db_home/oci/include
LIBPATH += D:/BaiduNetdiskDownload/WINDOWS.X64_193000_db_home/oci/lib/msvc
2.修改qsqldriverbase.pri
在目录下D:\Qt\Qt5.12.1\5.12.1\Src\qtbase\src\plugins\sqldrivers
QT = core core-private sql-private
# For QMAKE_USE in the parent projects.
#include($$shadowed($$PWD)/configure.pri) #注释掉 主要是加下面一行
include(./configure.pri) #重点
PLUGIN_TYPE = sqldrivers
load(qt_plugin)
DEFINES += QT_NO_CAST_TO_ASCII QT_NO_CAST_FROM_ASCII
3.管理员身份运行x64 Native Tools Command Prompt for VS 2022
进到D:\Qt\Qt5.12.1\5.12.1\Src\qtbase\src\plugins\sqldrivers\oci
D:\Qt\Qt5.12.1\5.12.1\mingw73_64\bin\qmake -- OCI_INCDIR=D:/BaiduNetdiskDownload/WINDOWS.X64_193000_db_home/oci/include OCI_LIBDIR=D:/BaiduNetdiskDownload/WINDOWS.X64_193000_db_home/oci/lib/msvc oci.pro
执行
nmake debug
nmake release
出现waring 可以不用管,上面两行命令均正常结束
继续执行
nmake install
不用手动将qsqloci.dll 复制
接着执行(参考QT官网)
set PATH=%PATH%;D:\BaiduNetdiskDownload\WINDOWS.X64_193000_db_home\bin
成功!!!
标签:oci,QT,QOCI,193000,WINDOWS,db,qoci,Oracle,home From: https://blog.csdn.net/jingjing_97/article/details/143625742