tags:

views:

24

answers:

1

On a centos, qt creator 1.2.1 qtsdk-2009.04

what step by step is needed to create mysql driver, in linux and in windows. such that running following command gives an positive output

QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL"); db.setHostName("xxxxxxxxxx"); db.setDatabaseName("xxxxxxxdb"); db.setUserName("xxxxxxxxxxx"); db.setPassword("xxxxxxxxxxx"); bool ok = db.open();

Brgds,

kNish

A: 

I used to have PostgreSQL(8.3) driver compiled successfully.Following is the batch cmds to do the job(replace the path with yours).

cd D:\SoftwareSetup\Dev\Qt\2009.05\qt\src\plugins\sqldrivers\psql

D:\SoftwareSetup\Dev\Qt\2009.05\qt\bin\qmake “INCLUDEPATH+=D:\SoftwareSetup\Dev\PostgreSQL\8.3\include” “LIBS+=D:\SoftwareSetup\Dev\PostgreSQL\8.3\lib\libpq.lib” psql.pro

@”D:\SoftwareSetup\Dev\Microsoft Visual Studio 9.0\VC\bin\nmake”

“D:\SoftwareSetup\Dev\Qt\2009.05\mingw\bin\mingw32-make”

pause

If you use VC compiler,use nmake to get it compiled, and I also referenced to following two links to find out library dependency:

http://lists.trolltech.com/qt-interest/2006-11/thread00265-0.html

http://doc.trolltech.com/4.6/sql-driver.html#how-to-build-the-qdts-plugin-on-windows

This page from Nokia Qt doc may be helpful on *nix(and Windows):

http://doc.qt.nokia.com/4.6/sql-driver.html#supported-databases

schemacs