开发者

Mysql Plug-in for Qt

I've installed recent Qt (4.5.3) sdk windows version. I'm want to use mysql in my app. Since Qt Mysql plugin in not available, so I compiled it from the included source. I copied compiled files D:\\Qt\2009.01\qt\plugins\sqldrivers.

Now when I run my 开发者_运维百科application it still error "QMYSQL driver not loaded".


I suggest you take the whole Qt4 source code and compile it specifically for your own needs.

Something like this should do the job just fine:

  1. Download the Qt source code from qt.nokia.com
  2. Extract it somehwere and open a command prompt.
  3. "cd" into the source directory and run "configure":

Just an example:

/Devel/qt/configure
    -release
    -fast
    -opensource
    -nomake "demos examples"
    -silent
    -qt-sql-mysql

You might have to additionally provide -I C:\path\to\mysql\includes and -L C:\path\to\mysql\libs.

After that, do "make install".

Hope that helps.


There may be several reasons leading to the driver not being loaded, I experienced several of them in my Qt experience. Qt provides good documentation on this point, I suggest you have a look at the Troubleshooting subsection of Qt Assistant's SQL Database drivers section, it should help you diagnose your problem. It worked for me.

Hope that helps.


After compiling the plugin, you need to add the MySQL bin path to your PATH environment variable.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜