ubuntu下Qt连接oracle的驱动怎么写

更新时间:01-22 教程 由 淡忘 分享

ubuntu下Qt连接oracle的驱动怎么写?

Windows下编译Oracle驱动

打开工程:

C:\Qt\4.8.1\src\plugins\sqldrivers\oci

修改oci.pro:

TARGET = qsqloci

SOURCES = main.cpp

include(../../../sql/drivers/oci/qsql_oci.pri)

include(../qsqldriverbase.pri)

INCLUDEPATH += D:\oracle2\product\11.2.0\dbhome_1\OCI\include

LIBPATH += D:\oracle2\product\11.2.0\dbhome_1\OCI\lib\MSVC

编译完成后,拷贝库文件到:

C:\Qt\4.8.1\plugins\sqldrivers

qsqloci4.lib

qsqlocid4.lib

qsqloci4.dll

qsqlocid4.dll

Linux下编译Oracle驱动

打开工程:

/usr/local/qt-4.5.2/src/plugins/sqldrivers/oci

查看并修改工程文件oci.pro :

[d5000@CentOS6-64 oci]$ cat oci.pro

TARGET = qsqloci

HEADERS = ../../../sql/drivers/oci/qsql_oci.h

SOURCES = main.cpp \

../../../sql/drivers/oci/qsql_oci.cpp

LIBPATH += /u01/app/oracle/lib

win32:LIBS *= -loci

unix:!contains( LIBS, .*clnts.* ):LIBS *= -lclntsh

macx:QMAKE_LFLAGS += -Wl,-flat_namespace,-U,_environ

include(../qsqldriverbase.pri)

编译完成后拷贝到相应目录。

声明:关于《ubuntu下Qt连接oracle的驱动怎么写》以上内容仅供参考,若您的权利被侵害,请联系13825271@qq.com
本文网址:http://www.25820.com/tutorial/14_2181429.html