Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Manually built OCI plugin for Win7-64 crashes
I've compiled and installed qt-everywhere-opensource-src-4.7.4 using mingw-w64-bin_x86_64-mingw_20111101_sezero build for windows 7 64 bit successfully. I build oci plugin for it and got qsqloci4.dll and libqsqloci4.a files. I wrote a test project to test the connectivity with Oracle. These files i have copied to the local release directory of my test project. I am getting the QOCI and QOCI8 in the list of available sql drivers. but when I run this program, it crashes by saying:-
The program has unexpectedly finished.
temp1.exe exited with code -1073741819
The test program is :
QSqlDatabase cldb_database = QSqlDatabase::addDatabase("QOCI"); cldb_database.setHostName("localhost"); cldb_database.setDatabaseName("orcl"); cldb_database.setUserName("scott"); cldb_database.setPassword("xyz"); if(!cldb_database.open()) qDebug()<<"Could not open Database Connection "; else qDebug()<<"database opened";
control is not getting past with the first line itself.
thanks in advance.
Hi and welcome to devnet,
Please enclose your code in coding tags so it's readable.
Now to your problem, you have an access violation, so is it the only code you have in your software ?
What happens if you run it through a debugger ?
thanks for warm welcome..
Here is the code:-
@QSqlDatabase cldb_database = QSqlDatabase::addDatabase(“QOCI”); cldb_database.setHostName(“localhost”);
if(!cldb_database.open()) qDebug()<<“Could not open Database Connection “;
else qDebug()<<“database opened”;@
yes, it is the only code in my software..
i am debugging it using x86_64-w64-mingw32-gdb-220.127.116.1100730 debugger.
dubugger is throwing SIGSEGV in function
@QOCIDriver::QOCIDriver(QObject* parent): QSqlDriver(parent)@
of qsql_oci.cpp while making following call :
@int r = OCIEnvCreate(&d->env,
Thanks in advance..
Ok, in that case, what does QSqlDatabase::drivers() return ?
"QSQLITE", "QODBC3", "QODBC", "QOCI8", "QOCI"
That's strange, but wait, why do you use such an old version of Qt ? Since you are on the 4 series why not use the 4.8.4 version ?
MadMax411 last edited by
Is a TNSPING to your database successful? (shell command: tnsping orcl)
And don't set the hostname for Oracle-DBs. You have to configure the database connections in the file "tnsnames.ora"
I found following on Mingw bug tracker and i am facing exactly the same problem:
"I wrote qt application that uses qsqloci driver to connect to Oracle. Plugin is built agains 11gR2 OCI. 32bit plugin works fine, but 64bit crashes on OCIEnvCreate function. The same plugin (and qt, and my app) compiled with Visual Studio works fine. Attaching backtrace. Note: Oracle OCI supplied with Oracle 11gR2 client is built with Visual Studio."
solution provided by Sezero is
" attempting to use x64 versions of VC libraries isn't supported and is well known to cause runtime crashes. Solution is generating .def files from the corresponding dlls using gendef and then making lib*.dll.a import libraries out of them using dlltool."
I have not checked the plugin with VS and I am not able to understand which dll Sezero is talking about.
[quote author="MadMax411" date="1367937167"]Is a TNSPING to your database successful? (shell command: tnsping orcl)
And don't set the hostname for Oracle-DBs. You have to configure the database connections in the file "tnsnames.ora"[/quote]
yes ,tnsping orcl is successful....
the problem is solved now...
solution can be found "here":http://sourceforge.net/tracker/index.php?func=detail&aid=3466815&group_id=202880&atid=983354
Thanks every1 :)
Please update the thread's title to solved so other forum users may know that a solution has been found :)