Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. QOCIDriver: unable to create environment <Solved>
Qt 6.11 is out! See what's new in the release blog

QOCIDriver: unable to create environment <Solved>

Scheduled Pinned Locked Moved Installation and Deployment
2 Posts 1 Posters 7.8k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    H.Klingel
    wrote on last edited by
    #1

    Hi,

    I'm trying to move my application to 64 bits. That's why I build qt4.7.3 with the VS2010 x64-compiler. I've used -qt-sql-oci in the configuration because I need a connection to an Oracle DB. As includes, I took the oci.lib and oci.h from the same instant client sdk where I get the oci.dll from.

    When I look at QSqlDatabase::drivers() it says "QSQLITE QOCI8 QOCI" so I guess, QSqlDriver did compile with oci.

    But the moment I run QSqlDatabase::add("QOCI") there is an error:
    Warning: QOCIDriver: unable to create environment
    and lastError() says: Unable to initialize.

    isValid() returns true, though.

    I've already checked QApplication::getLibraryPath and made sure, the oci.dll is in the correct Folder but no success.
    I added the path of the original location of oci.dll to PATH - nothing.

    I'm going crazy. In 32-bits version everything went smooth, but in 64 bits...

    Any help is greatly appreciated.

    Kind regards,
    Harald

    1 Reply Last reply
    0
    • H Offline
      H Offline
      H.Klingel
      wrote on last edited by
      #2

      Finally I've solved this.
      There were two things wrong.
      (1) I've configured the qt build with -qt-sql-oci and -plugin-sql-oci. There can only be one of them, the second one overrides the first. That's why QOCIDriver has not been included in QSql4
      (2) The wrong oci.dll has been loaded. There was a copy of oci.dll (win32) in my debug folder. Don't known how it got there, but in any case this one was found before checking the path I've set in the debugging environment. I found that in the output of VS2010, where a list of all drivers loaded is shown.

      Some general tips for comiling qt with oci:

      • check if the oci.lib and oci.dll have been build in the same mode (x64 or win32). You can do that in a VisualStudio command prompt with DUMPBIN /headers xxx.xxx
      • configure the include path by using -I D:\Oci64\includes (or where ever you store these files
      • configure the library path by using -L D:\Oci64\lib

      That's it.
      Greetings,
      Harald

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved