Results 1 to 4 of 4

Thread: Oracle Call Interface (OCI) driver problems

  1. #1
    Join Date
    Jul 2010
    Location
    Tampere, Finland
    Posts
    10
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Unhappy Oracle Call Interface (OCI) driver problems

    So, now I'm getting rather desperate here. Old threads here don't seem to be of any help.
    In 2010 I managed to compile and use OCI driver with my program.

    Now however, I installed Qt Creator 2.2.0 (Qt 4.7.4) on Windows XP and now I am completely unable to do anything with the Oracle database.

    First of all, I would try to compile the driver again but there's no src directory nor the oci.pro file.

    Secondly, I still have the driver that I compiled a year ago, I've tried to use that file but so far I haven't got any results.

    Is there any kind soul out there who could tell me what I'm supposed to do if I want to connect my program to oracle database? Qt help doesn't make me any wiser

  2. #2
    Join Date
    Jul 2010
    Location
    Tampere, Finland
    Posts
    10
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Oracle Call Interface (OCI) driver problems

    Now I figured out that the SDK 1.1.1 doesn't seem to include the libraries for some reason so I downloaded and installed the libraries (4.7.3). I suppose I have all the files so now I've managed to get myself stuck to line 5 in the following (using Qt 4.7.3 Command Prompt):
    Qt Code:
    1. set INCLUDE=%INCLUDE%;c:\oracle\oci\include
    2. set LIB=%LIB%;c:\oracle\oci\lib\msvc
    3. cd %QTDIR%\src\plugins\sqldrivers\oci
    4. qmake oci.pro
    5. nmake
    To copy to clipboard, switch view to plain text mode 

    When I try to run (n)make, I get an error telling me that the oci.h file is not found. How I am supposed to tell to make that the file exists there? oci.h is located in the c:\oracle\oci\include but why make doesn't recognize it?

  3. #3
    Join Date
    Jul 2010
    Location
    Tampere, Finland
    Posts
    10
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Question Re: Oracle Call Interface (OCI) driver problems

    (I'm running on Win XP SP3 by the way)

    Everything seemed to lead me to a dead-end, so I did the following:

    I uninstalled everything that had anything to do with Qt and Oracle

    I got the Oracle Database 10g Express Client from http://www.oracle.com/technetwork/da...ft-090667.html and installed it to its default path C:\XEClient

    I got Qt SDK 1.1.1 (offline installer) from http://qt.nokia.com/downloads and made a custom installation. From the components I checked Documentation, Qt Examples, MinGW 4.4, Qt Designer, Desktop Qt 4.7.3 - MINGW and Qt Linguist. I installed it to its default path of C:\QtSDK

    Just to make sure (don't know excactly why) I reinstalled also Microsoft Visual C++ 2010 Express http://www.microsoft.com/express/Dow...010-Visual-CPP

    Then when everything was (re)installed, I started the Maintain Qt SDK tool found from the Start menu or through Qt Creator (Help - Start updater). From there (from Package manager tab) I checked under Miscellaneous - Qt Sources the Qt 4.7.3 Sources component.

    Then I set the environment variables (right click my computer - properties - advanced - environment variables) and added there LIB with value C:\XEClient\oci\lib\msvc and INCLUDE with value C:\XEClient\oci\include

    After this I ran the Qt 4.7.3 for Desktop (MinGW) command prompt from the start menu and I wrote in the following
    Qt Code:
    1. set QTDIR=C:\QtSDK\QtSources\4.7.3
    2. cd %QTDIR%\src\plugins\sqldrivers\oci
    3. qmake oci.pro
    To copy to clipboard, switch view to plain text mode 

    If I recall correctly everything worked fine until this point. Then I tried to run nmake but then I got an error that C:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtSql directory was missing a file, private\qsqlcachedresult_p.h so I searched for that file and I found it from C:\QtSDK\QtSources\4.7.3\src\sql\kernel directory, so I created a the missing directory C:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtSql\priv ate and copied the qsqlcachedresult_p.h there.

    After that I tried to run nmake again but it still puked on my face, complaining about missing oci.h file. So I manually edited Makefile.release and Makefile.debug files in %QTDIR%\src\plugins\sqldrivers\oci. I added there in the INCPATH section the following: -I"C:\XEClient\oci\include"

    Now I everything should be ready to run
    Qt Code:
    1. nmake
    To copy to clipboard, switch view to plain text mode 

    FINALLY after that nmake didn't complain about anything and it made the following files in the %QTDIR%\src\plugins\sqldrivers\oci\debug directory:
    • libsqlocid4.a
    • main.o
    • moc_qsql_oci.cpp
    • moc_qsql_oci.o
    • qsql_oci.o
    • qsqlocid3.dll
    • qsqlocid_resource_res.o

    After that I ran
    Qt Code:
    1. nmake release
    To copy to clipboard, switch view to plain text mode 
    which gave me the following files to %QTDIR%\src\plugins\sqldrivers\oci\release directory:
    • libsqloci4.a
    • main.o
    • moc_qsql_oci.o
    • qsql_oci.o
    • qsqloci4.dll
    • qsqloci_resource_res.o


    So now I should have the OCI plugin. According to my notions, the .a and .dll files from both debug and release folders should be copied to C:\QtSDK\Desktop\Qt\4.7.3\mingw\plugins\sqldrivers directory

    This way when I run my build in Debug or Release mode the code
    Qt Code:
    1. qDebug() << QSqlDatabase::drivers();
    To copy to clipboard, switch view to plain text mode 
    Shows in debug screen that I have QOCI and QOCI8 available.

    HOWEVER. I am now getting the following error when I try to use
    Qt Code:
    1. QSqlDatabase::addDatabase("QOCI")
    To copy to clipboard, switch view to plain text mode 

    QObject::moveToThread: Current thread (0x3e5448) is not the object's thread (0xa17de28).
    Cannot move to target thread (0x3e5448)


    Now, is there anyone who could tell what is wrong here?
    Last edited by Ionwind; 31st May 2011 at 11:55. Reason: updated contents

  4. #4
    Join Date
    Jul 2010
    Location
    Tampere, Finland
    Posts
    10
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Oracle Call Interface (OCI) driver problems

    Finally solved this last problem. So I managed to build a working plugin with the procedure mentioned above. The last problem with the threads (that shouldn't have anything to do with this) occurred because I was calling a member function of a class that wasn't yet constructed. The builder/compiler doesn't think that this is an error, so it's quite hard to notice it.

    Anyway, problem solved.

Similar Threads

  1. Problems trying to compile driver firebird
    By estanisgeyer in forum Qt Programming
    Replies: 3
    Last Post: 19th July 2011, 14:22
  2. Replies: 1
    Last Post: 8th October 2010, 11:38
  3. Error compiling oracle oci driver for Qt database
    By NAYZAKAY44 in forum Qt Programming
    Replies: 0
    Last Post: 25th August 2010, 18:13
  4. Compiling oracle oci driver for Qt
    By NAYZAKAY44 in forum Newbie
    Replies: 0
    Last Post: 25th August 2010, 18:11
  5. OCI(oracle)driver adding to plugin
    By jjbabu in forum Qt Programming
    Replies: 0
    Last Post: 22nd April 2009, 12:04

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.