PDA

View Full Version : QOCIDriver: unable to create environment problem



Momergil
29th July 2013, 21:39
Hello!

I'm trying to connect to a remote Oracle database using Qt without success. The returned errors are "QOCIDriver: unable to create environment problem" and and error returned by lastError().text() is "Unable to logon". I'ld guess that's simply some problem in the data passed as configuration, but it's not: I checked it dozens of times. It's interesting to point out that I'm able to ping the remote server and a friend of mine did a testing application using MVS that was able to conenct to the database. I do have the QOCI driver etc.. The connection code is the sabe, basic code used in any example of connection to a database with Qt. What could be the problem? Unfortunately I don't get any other error message apart from these two when running in debug mode.

9379

I'm glad for any help!

Momergil

Added after 1 48 minutes:

Ok, it seems I found the answer in this post: http://www.qtcentre.org/threads/48885-QOCIDriver-unable-to-create-environment

I read it first, but I didn't think that I needed to download that "Instant Client" things that ChrisW67 talked about and put it in the same folder as my application.




Momergil

Momergil
31st July 2013, 22:13
Ok - the problem is NOT solved. I thought I corrected my problem by downloading the .zip instant client installer and putting it in the same folder as my application - since it began to work after that -, but it seems now it has nothing to do with it, not just because it's working without, but also because I didn't even did the whole installation (putting the ORACLE_HOME as system variable, etc.) and still it worked. Rather, it seems it has much more to do with the fact I [re]installed the oracle database in my PC...

But than, I got a problem. I want now to execute my app in another machine where I can't simply go there and install the oracle database... And putting the oracle client installer + ORACLE_HOME/Path haven't worked. I ask myself if the solution is that there is something lacking or is now a Qt problem, since the necessary steps for it to work, in accord to the Oracle documentation, were performed - and yet I still smell something related to installing the database...


Any help would be welcomed :)

Momergil
1st August 2013, 16:46
Ok, I found a development... As ChristW67 pointed out in the other topic, the ORACLE_HOME must be pointed to a folder where a "BIN" folder is located. Inside it there is quite a lot of dlls that oracle connection needs to work. Since I haven't installed (and can't do it) the oracle database on the required PC, that environment variable/registry entry was not located ant the QOCI wasn't being able to do its work. Now that I entered the ORACLE_HOME as an environment variable and put some of the "BIN" Dlls there, it seems that Oracle began to find itself. The problem is that there is no chance I'm going to download 250 Mb of dlls and executables from my personal Oracle database to my client's computer, so I'm need of an application that tells me which dlls are required for my program to run. Process Explorer unfortunately don't do this, since it only tells which DLLs are already running.


Any help in this problem would be welcomed :)

ChrisW67
2nd August 2013, 00:09
Deploy your application with your compiled Qt OCI plugin.

Install the Oracle Instant Client either from your Oracle Universal Installer or

Download "Basic" or "Basic Lite" from http://www.oracle.com/technetwork/database/features/instant-client/index.html
Download "SQL*Plus" from same place
Read instructions in same place
You may need to ensure MSVCR100.DLL is on your target machine. Microsoft Visual C++ 2010 Service Pack 1 (http://www.microsoft.com/en-us/download/details.aspx?id=26999#)
Ensure that Sql*Plus can connect to your database. If it cannot connect chances are very good your Qt program cannot.
See http://www.oracle.com/technetwork/database/features/oci/ic-faq-094177.html#A4428
Making that part work is between you and Oracle.


Once that is working you will probably find you only need to deploy OCI.DLL and anything it directly depends on.

Momergil
7th August 2013, 02:06
Thanks Chris for the help, but at the end I managed to make my application work by installing a different option in Oracle's Universal Installer (something about installing the database's softwares, not the database itself). It seems that this option happens to install a lot of dlls and .exe that, at the end, made my app work. It's quite interesting, though, that I had to do this, since Oracle's instructions don't include doing such step - that ended with 3 Gb from my PC btw :x -, but only installing the Oracle Client thing :T

But thanks anyway :)

Momergil