Important: Please read the 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");
        qDebug()<<"Could not open Database Connection ";
        qDebug()<<"database opened";

    control is not getting past with the first line itself.

    Pls help...

    thanks in advance.

  • Lifetime Qt Champion

    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(! 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- 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..

  • Lifetime Qt Champion

    Ok, in that case, what does QSqlDatabase::drivers() return ?

  • QSqlDatabase::drivers() returns


  • Lifetime Qt Champion

    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 ?

  • 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.

    plz help....

  • [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....

  • @all :

    the problem is solved now...

    solution can be found "here":

    Thanks every1 :)

  • Lifetime Qt Champion

    Great !

    Please update the thread's title to solved so other forum users may know that a solution has been found :)

Log in to reply