Problem, how to connect c++ and Oracle [message #348675] |
Wed, 17 September 2008 09:50 |
yongluouk
Messages: 9 Registered: September 2008
|
Junior Member |
|
|
My OS is Linux and I installed Oracle 10.2. Everything is fine.
I can use sqlplus, exp, imp etc with no problem.
Now I have created another linux user test in /home/test.
I unzipped basic-10.2xxxxxx.zip (/home/test/instantclient_10_2) and exported LD_LIBRARY_PATH.
I guess I have installed instant client in this way.
My testOra.cpp:
#include <occi.h>
int main()
{
return 0;
}
This test.cpp would not compile. It cannot find occi.h
Would you please tell me what to do?
Thank you in advance.
|
|
|
|
Re: Problem, how to connect c++ and Oracle [message #348920 is a reply to message #348682] |
Thu, 18 September 2008 05:31 |
yongluouk
Messages: 9 Registered: September 2008
|
Junior Member |
|
|
Thank you very much, Michel.
The occi.h and other related header files are in
$ORACLE_HOME/rdbms/public/.
I changed the permission, but I still cannot use occi.h.
Then I copy all files to /home/test/public/, and it compiles.
But I am not sure whether this is a right way.
Yong
|
|
|
|
Re: Problem, how to connect c++ and Oracle [message #348957 is a reply to message #348941] |
Thu, 18 September 2008 06:52 |
yongluouk
Messages: 9 Registered: September 2008
|
Junior Member |
|
|
Michel, thank you very much again.
I have a root user and have permission to change anything.
In my test user, /home/test, the .bashrc file looks like:
...
export LD_LIBRARY_PATH = $LD_LIBRARY_PATH:/home/test/instantclient_10_2/
.....
There is not other exports for test user.
The user oracle, /home/oracle, in the .bash_profile file,
...
export ORACLE_HOME=...
export ORACLE_SID=...
.....
Would you please tell me what others I should export?
I am new for B shell script.
Yong
|
|
|
|
Re: Problem, how to connect c++ and Oracle [message #348984 is a reply to message #348960] |
Thu, 18 September 2008 08:37 |
yongluouk
Messages: 9 Registered: September 2008
|
Junior Member |
|
|
Hi Michel,
I am not sure what you mean.
But I have got a new problem. My testOra.cpp is the following.
#include <occi.h>
using namespace oracle::occi;
int main()
{
Environment* env = Environment::createEnvironment();
...
return 0;
}
Compile command:
g++ -I /home/test/public/ testOra.cpp
Error: undefined reference Environment::createEnvironment....
Thank you,
Yong
|
|
|
|
|