QOCIDriver: unable to create environment <Solved>
-
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 -
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