MiPro 17.01: Oracle-Error Allocating OCI environment handle

163 views
Skip to first unread message

Stefan

unread,
Sep 22, 2018, 8:16:43 AM9/22/18
to mapi...@googlegroups.com
Hi there,

i'm experiencing a strange Problem here.

I've developed an MS-Access-application in VBA that starts MiPro in the Background via 

Set objMapInfo = CreateObject("Mapinfo.Application.x64")

Now i've three Computers running that app, but it does so only on one machine, on the other two i get this error 

OCI_Error_Message.png


Oracle-Error: Allocating OCI Environment handle.

Searching the Internet i found a short article on the PB Website About that Problem with MiPro 32-Bit, explaining that the Problem may be solved by reinstalling the Oracle Client matching the MiPro-Version. In my case that would mean: reinstall the whole Oracle DB, - no way!

I checked the machines for differences.

All running Windows 10 Pro 64-Bit / 1803 / German / MiPro 15.03 DE / MiPro 17.01 Advanced / Oracle 12.2 32-Bit Instant Client / Oracle 12C Enterprise DB / same MS-Office Version.
Setup is the same, 32-bit MiPro can Access the Oracle db as well.
In the path on all machines the 64-bit Oracle bin-path Comes before the 32-bit instant Client path. The Oracle global variables are the same.

On all three machines it's no Problem to load a spatial layer from the local Oracle instance in MiPro 17.01 when started regulary via Windows startmenu, but when i issue the vba-codeline above, on two machine i get that error message instantly, on one of the machine everything runs as expected.

Attached you will find an MS-Access Database demonstrating the strangeness of that problem. To make it work you will have to edit the query- and connection-parameters in the function "EO_Get_Value_List" in Module1. The function generates a delimited list of  the string values of an oracle table column.
If you managed to make that work, you can click on the button "Get Oracle Values" on the main form, that will fill the oracle-values listbox.

So, if you now close the database and open it again, you can try to click on the buton "Start MiPro64", that will try to create a MiPro object in the background.
In my case i get a "General protection fault" some 30 seconds later, and a nice MiPro.dmp file in my temp-Directory.

BUT

if i close the database and open it up again, and click first on the button "Get Oracle Values" and click afterwards on the button "Start MiPro64" the above errormessage appears instantely, and no oralce connection with this instance of MiPro is possible.


After many Hours of searching i'm lost, and any thoughts are highly welcome.

Thanks and have a nice Weekend

Stefan
Test.zip

Eric Blasenheim

unread,
Sep 23, 2018, 2:26:36 PM9/23/18
to MapInfo-L
Stefan,
The key is that you need a 64-bit Oracle OCI client on every machine where Pro (or any other 64-bit client) is installed for us to talk to Oracle.  Those client dlls can just be the "instant client" but they need to be there and be accessible (via the system path) for MapInfo Pro to load.  This is not a MapInfo limitation, this is the way 32 and  64 bit machine software works on all systems.
It seems you have the Oracle database on the same machine but that should not matter other than the fact that the 64-bit client dlls may already be there. 
But what you need to do is:
Make sure the 64-bit version of oci.dll and its dependent dlls (what comes with the instant or full client) are on the machine. 
Make sure that location is on the system path when MI Pro is running. Since you are launching Pro via COM/VBA this may mean it needs to be on the true system level path as we are being launched by the system and not directly your VBA program.  You can see what path an executable truly has at run time via tools like Windows Process Explorer. 
Note that some people think there is an issue with having the 32 and 64 bit versions on the path. In general, this is not true. When MI Pro tries to load OCI via the Windows API, the 64-bit OS completely ignores any 32 bit DLLs that happen to have the name OCI.DLL.  So the order on the path does not matter.  (if you try programmatically to point a 64-bit program to a 32 bit dll with an explicit path, Windows tells you this is not an executable).
When the loading of a particular Oracle table uses a SSID whose description is in the tnsnames.ora file, for OCI to locate those and know what they mean., their code uses the TNS_ADMIN environment variable to locate that file.  So it should be set to the location of  the tnsnames.ora file. 

But really it is just making sure Pro can load the 64-bit OCI.DLL 
I hope this helps.
Eric Blasenheim
Pitney Bowes Software.


On Saturday, September 22, 2018 at 8:16:43 AM UTC-4, Stefan wrote:
Hi there,

i'm experiencing a strange Problem here.

I've developed an MS-Access-application in VBA that starts MiPro in the Background via 

Set objMapInfo = CreateObject("Mapinfo.Application.x64")

Now i've three Computers running that app, but it does so only on one machine, on the other two i get this error 

OCI_Error_Message.png


Oracle-Error: Allocating OCI Environment handle.

Searching the Internet i found a short article on the PB Website About that Problem with MiPro 32-Bit, explaining that the Problem may be solved by reinstalling the Oracle Client matching the MiPro-Version. In my case that would mean: reinstall the whole Oracle DB, - no way!

I checked the machines for differences.

All running Windows 10 Pro 64-Bit / 1803 / German / MiPro 15.03 DE / MiPro 17.01 Advanced / Oracle 12.2 32-Bit Instant Client / Oracle 12C Enterprise DB / same MS-Office Version.
Setup is the same, 32-bit MiPro can Access the Oracle db as well.
In the path on all machines the 64-bit Oracle bin-path Comes before the 32-bit instant Client path. The Oracle global variables are the same.

On all three machines it's no Problem to load a spatial layer from the local Oracle instance in MiPro 17.01 when started regulary via Windows startmenu, but when i issue the vba-codeline above, on two machine i get that error message instantly, on one of the machine everything runs as expected.

The only difference i was able to find is, that the machine without Errors is running Oracle DB 12.1 while the other failing machines are running 12.2.

I would think that it's quite unprobable that this is the source of this Problem, - but what else?

Stefan

unread,
Sep 24, 2018, 3:38:30 AM9/24/18
to MapInfo-L
Good morning Eric,

thanks for this fast reply.

But as i wrote: On all machines i can launch MiPro from the start menu and load Oracle layers just fine. On all machines a full Oracle Enterprise 64-bit database installation is present and the bin directory in the path, - as well as the 32-bit instant client directory.
Loading Oracle spatial layers from 32-bit MiPro 15 on the same machines works as well.

So this cannot be the issue, - from my point of view.

The strange thing is, that starting MiPro 64-Bit via COM/VBA does work on these two machines, but not if you made an oracle 32-bit connection from within ms-access before (as explained above).

You mentioned process explorer. i used that yesterday to see, what's going on there and found, that when i get that error message, the access to the oci.dll looks different, - but i'm not expert enough to know, if that means anything.
Everytime, and i tested that many times, - that error comes up, MiPro doesn't actually read the oci.dll (the marked red part), - as it does, when successfully started.

Successfull load:

OCI_access_successfull.png


Unsuccessfull load attempt:

OCI_access_unsuccessfull.png


And as you can see: MiPro can find the correct oci.dll.

... and on the machine running version 12.1 of Oracle enterprise, even that lauch works.

Thanks in advance for any further help
and
Best regards

Stefan

Stefan

unread,
Sep 25, 2018, 9:53:55 AM9/25/18
to MapInfo-L
Found the solution by myself:

Everything works as expected, if you set on ORACLE_HOME-Variable to point at your 64-Bit Installation.
It stays a bit strange, that running MiPro from windows start menu works flawless with oracle connections but starting via COM doesn't.

Anyway, it works now, - great.

Stefan

Sidhu Sidvester

unread,
Apr 21, 2020, 1:41:53 AM4/21/20
to MapInfo-L
Hi Stefan,

Good Day!
Could you please share the screenshot of the below ORACEL_HOME Variable .am also facing the same issue.

-Sidhu
Reply all
Reply to author
Forward
0 new messages