☆Smoozer☆

::Easy Life.
How to build QMySQL and QOci plugin for QT4

Here are sumary about building database plug-ins when using Qt4.

1. MySQL:

You need to get the MySQL installation files. Run SETUP.EXE and choose "Custom Install". Install the "Libs & Include Files" Module. Build the plugin as follows (here it is assumed that MySQL is installed in C:\MySQL):

For Windows:

cd %QTDIR%\src\plugins\sqldrivers\mysql

qmake "INCLUDEPATH+=C:\MySQL\include" "LIBS+=C:\MYSQL\MySQL Server <version>\lib\opt\libmysql.lib" mysql.pro

nmake

If you are not using a Microsoft compiler, replace nmake with make in the lineabove.

2. Oracle 10g (Oci) 

After install oracle 10g express edition, go to Qt’s Command Prompt window.

For Windows:
set INCLUDE=%INCLUDE%;d:\oraclexe\app\oracle\product\10.2.0\server\OCI\include

set LIB=%LIB%;d:\oraclexe\app\oracle\product\10.2.0\server\OCI\lib\MSVC

cd %QTDIR%\src\plugins\sqldrivers\oci

qmake -o Makefile oci.pro

nmake


For Linux:

cd $QTDIR/src/plugins/sqldrivers/oci

qmake "INCLUDEPATH+=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/rdbms/public /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/rdbms/demo" "LIBS+=-L/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/lib" oci.pro
//must make sure oci.h can be included in include path.
make

posted on 2010-01-27 13:58  smoozer  阅读(424)  评论(0编辑  收藏  举报