Oracle driver does not work (Solved)
-
Hi guys,
I have a Qt desktop application with oracle driver (qsqloci). But my app give follow error:
"The file '/Users/fronald/opt/QtSDK/QtSources/4.7.4/src/plugins/sqldrivers/oci/libqsqloci_debug.dylib' is not a valid Qt plugin."
My build profile is DEBUG, and the oracle instant client libraries are in DYLD_LIBRARY_PATH. The libqsqloci has been compiled without problems.
I'm using the follow code to load the oci plugin:
@QPluginLoader loader(libPath);
loader.load();
QObject *plugin = loader.instance();if (!plugin){ qDebug() << "ERROR: Oracle plugin not loaded."; qDebug() << loader.errorString(); return FALSE; }else{ QSqlDriverPlugin *sqlPlugin = qobject_cast<QSqlDriverPlugin *>(plugin); if (!sqlPlugin ) { return FALSE; }else{ qDebug() << "INFO: Oracle plugin loaded."; this->db = QSqlDatabase::addDatabase(sqlPlugin->create("QOCI"),this->conn_name); db.setHostName(server); db.setDatabaseName(sid); db.setUserName(username); db.setPassword(password); db.open(); return db.isOpen(); } }@
The libPath var contains the dylib location.
This same code works fine on Windows, but on MacOSX nothing.
Any ideas?
-
The architectures in the universal binaries must match. The instant client is usually only i386 (Intel 32 bit) or x86_64 (Intel 64 bit), but not both as the usual executables. You should make your application project to only build with the architecture you have your instant client with:
@
QT += x86_64
QT -= i386 ppc ppc_64
@Swap i386 and x86_64 if you have 32 bit instant client.
-
Hi Volker,
Thank you for your reply. <MYPROJECT>.pro:
@
QT += core gui sqlQT += x86_64
QT -= i386 ppc ppc_64TARGET = MastersafInteg
TEMPLATE = appSOURCES += main.cpp
mainwindow.cpp
preferences.cpp
appconfig.cpp
dbconnection.cppHEADERS += mainwindow.h
preferences.h
appconfig.h
dbconnection.hFORMS += mainwindow.ui
preferences.uiRESOURCES +=
icons/icons.qrc
@Now, the oci.pro:
@
TARGET = qsqlociSOURCES = main.cpp
include(../../../sql/drivers/oci/qsql_oci.pri)include(../qsqldriverbase.pri)
QT += x86_64
QT -= i386 ppc ppc_64LIBS += -L/Volumes/HITACHI/Programas/instantclient_10_2
INCLUDEPATH += /Volumes/HITACHI/Programas/instantclient_10_2/sdk/include
@But at qmake run, the follow error is show:
Project MESSAGE: Warning: unknown QT: x86_64
Project MESSAGE: Warning: unknown QT: x86_64
Project MESSAGE: Warning: unknown QT: x86_64After, the build is successful and i get the same error. (...is not a valid Qt plugin)
Any idea?
Thanks!
-
Wow! Progress! But still not success.
INFO: Oracle plugin in location "/Users/fronald/opt/QtSDK/QtSources/4.7.4/src/plugins/sqldrivers/oci/libqsqloci_debug.dylib"
INFO: Oracle plugin loaded.
Segmentation fault: 11My debug message "INFO: Oracle plugin loaded." is before the code line:
@
this->db = QSqlDatabase::addDatabase(sqlPlugin->create("QOCI"),this->conn_name);
@Here, my application launch a Segmentation Fault signal.
Any ideas?
But thank you! The CONFIG variable have success!
-
Volker,
Thanks for your help. The my problem with plugin is solved. Now i have a problem with instant client 64bits. That issue has described here https://forums.oracle.com/forums/thread.jspa?threadID=2256568.
Thanks!
-
Absolutely right.
The libclntsh.so is crashed on 64bits. On the Oracle forum, they say for use the 32bits version of oracle client. The 64bits on Lion does not open sqlplus.
Oh... Oracle...
The Oracle have a own world.
Thanks man!
-
[quote author="fronald" date="1326671930"]Absolutely right.
The libclntsh.so is crashed on 64bits. On the Oracle forum, they say for use the 32bits version of oracle client. The 64bits on Lion does not open sqlplus.
Oh... Oracle...
The Oracle have a own world.
Thanks man![/quote]
Oh yes, what a true word :-)
I managed to avoid 64 bit oracle on the Mac up to now. And reading this, I won't change that any soon :-)Good luck!