Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ Oracle
Hi,
 
I am using OCILIB (http://orclib.sourceforge.net/[^]) to connect to ORACLE from my c++ program.
But whenever i try to connect to 11g database. It crashes while calling OCI_ConnectionCreate. Application works fine for 10g.
 

Any clue ?
 

 
It works for one more scenario,
If i create oledb connection to the same database and close it. I can connect through 11g as well. Dont know how it works :(
Posted 23-Jul-12 2:49am
Comments
Wes Aday at 23-Jul-12 7:55am
   
Would best be answered at http://orclib.sourceforge.net
PrafullaVedante at 25-Jul-12 11:00am
   
It was crashing , as i was calling OCIInitialize function from dllmain function. i moved it to other function and the code is working....
 
Moral of the story : Thumb rule is , we should not use any user code in dllmain.
Joan Murt at 25-Jul-12 13:02pm
   
Not an answer but a joke: I've been tempted to write: I feel it quite normal, I'm having problems to get my phone connected to 3G and you want to connect to 11G! :OMG:
PrafullaVedante at 25-Jul-12 23:01pm
   
he he he Good one :)
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

It was crashing , as i was calling OCIInitialize function from dllmain function. i moved it to other function and the code is working.... Moral of the story : Thumb rule is , we should not use any user code in dllmain.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

If you want to connect to Oracle 11g, then you have to use OCILIB from Oracle 11g, not the one from Oracle 10. So, change the lib and rebuild the program Smile | :)
  Permalink  
v2
Comments
PrafullaVedante at 13-Aug-12 6:44am
   
It was crashing , as i was calling OCIInitialize function from dllmain function. i moved it to other function and the code is working.... Moral of the story : Thumb rule is , we should not use any user code in dllmain.
armagedescu at 13-Aug-12 7:40am
   
I don't believe there is such a restriction. If there is such a restriction, could you point exactly to official documentation from Oracle where it is?
PrafullaVedante at 14-Aug-12 3:17am
   
Ammmm ...
Have a look at this http://msdn.microsoft.com/en-us/library/windows/desktop/ms682583%28v=vs.85%29.aspx
 
It says that , there are very few operations which you can safely do in dllMain.
armagedescu at 14-Aug-12 7:13am
   
Anyway, I don't see there the cause of crash. If the problem is in library loading precedence, then load your dll explicitly with LoadLibrary, and there will be no problem with DllMain. But if OCIInitialize loads other dll, then you probably have no choice. In fact this is why DllMain exist. For initialization. All depends on how your dll is used.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web02 | 2.8.1411022.1 | Last Updated 31 Jul 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100