PDA

View Full Version : question about sqldrivers



yuzhouzhiwai
26th March 2014, 05:42
hi,

I have a program with mysql in linux. So i need the qsqlmysql.so . I put the qsqlmysql.so to the directory /usr/local/Trolltech/qt4.4.3/plugins/sqldrivers/, my program worked ok. But when I put the qsqlmysql.so to the directory /usr/local/Trolltech/qt4.4.3/lib/ ,it tell me driver not loaded, that the program cannot find the lib.
the LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/Trolltech/qt4.4.3/lib/

so I think it will be worked ok, But it is not when I put the qsqlmysql.so to the directory /usr/local/Trolltech/qt4.4.3/lib/ . It seems that I must put the qsqlmysql.so to the directory /usr/local/Trolltech/qt4.4.3/plugins/sqldrivers/。

Is that really?
I am confused, and I don't know the reason.

thankyou for your help

thankyou

wysota
26th March 2014, 06:46
As the docs say the driver should be in a subdirectory "sqldrivers" of a directory where the application searches for plugins (e.g. the directory where the application binary is located).

yuzhouzhiwai
26th March 2014, 10:03
thanks for your answer.
I know what the docs say. But I want to know why the driver should be a subdirectory "sqldrivers" of a directory.
whether can I control the application ,and tell it where to search plugins?

wysota
26th March 2014, 10:43
But I want to know why the driver should be a subdirectory "sqldrivers" of a directory.
Because that's where the code that loads sql drivers looks for them.


whether can I control the application ,and tell it where to search plugins?
You can control where the application looks for plugins but it will still look into specific subdirectories of the path you provide. If you don't want that, you can embed plugin code directly in your application (however of course it won't be a plugin anymore and will be part of your app regardless if the app needs it or not).