here a program CPP+oracle10g@redhat4, guide me to solve error
hi to all,
this is my environment which i configured on my own, so if you found any possibilities of bugs on this configuation means please let me know. 1. i installed redhat4 in two systems machine1 and machine2 2. @machine1 i installed oracle10g server 3. @machine2 i installed oracle10g client 4. and @all other xp systems inthat lab i put putty@telnet to work on this Machine2 redhat environment. 5. i wrote a c++ program with the bakend of oracle10g 6. the g++ command used to copile the CPP program along with link files worked properly and rised no bugs 7. the make command generates the appropriate object file with out any bugs too 8. when i tried to run the object file it throughs error as such linker file conflicts or duplicates or something. so can any one help me to solve this problem The test.cpp file: #include <iostream> #include <occi.h> using namespace oracle::occi; using namespace std; class testOcci{ private: Environment *env; Connection *conn; Statement *stmt; public: testOcci (string user, string passwd, string db) { env = Environment::createEnvironment (Environment::DEFAULT); conn = env->createConnection( user, passwd,db); } ~testOcci () { env->terminateConnection(conn); Environment::terminateEnvironment (env); } }; int main(void) { string user="scott"; string passwd="tiger"; string db="spdc"; testOcci *demo = new testOcci (user, passwd, db); cout << "Creation Successful" << endl; delete (demo); cout << "Deletion Successful" << endl; return 0; } to find the occi.h file location using find -name occi.h the result is ./oracle/product/10.2.0/client_1/rdbms/public/occi.h to compile the test.cpp program g++ -L/home/oracle/oracle/product/10.2.0/client_1/lib -L/home/oracle/oracle/product/10.2.0/client_1/rdbms/public -I /home/oracle/oracle/product/10.2.0/client_1/rdbms/public -o test.o -c test.cpp this generates 0 bugs, compiles successfully then to make the test.o program make -f /home/oracle/oracle/product/10.2.0/client_1/rdbms/demo/demo_rdbms.mk buildocci EXE=run OBJS=test.o this generates the following error /usr/bin/g++ -L/home/oracle/oracle/product/10.2.0/client_1/lib/ -L/home/oracle/oracle/product/10.2.0/client_1/rdbms/lib/ -o run new.o -locci -lclntsh `cat /home/oracle/oracle/product/10.2.0/client_1/lib/sysliblist` -ldl -lm /usr/bin/ld: warning: libstdc++.so.5, needed by /home/oracle/oracle/product/10.2.0/client_1/lib//libocci.so, may conflict with libstdc++.so.6 then when i use "ls -l" to list the files at the home directory along with its file types the result is -rwxr-xr-x 1 oracle oinstall 478343213 May 21 06:14 10201_client_linux32.zip -rw-r--r-- 1 oracle oinstall 27 May 28 11:04 afiedt.buf drwxr-xr-x 6 oracle oinstall 4096 Jul 2 2005 client drwxr-xr-x 2 oracle oinstall 4096 May 28 10:41 Desktop -rw-r--r-- 1 oracle oinstall 671 May 28 11:20 test.cpp -rw-r--r-- 1 oracle oinstall 5012 May 28 11:23 test.o drwxrwx--- 3 oracle oinstall 4096 May 26 15:03 oracle drwxrwx--- 6 oracle oinstall 4096 May 26 15:06 oraInventory -rwxr-xr-x 1 oracle oinstall 50519 May 28 11:24 run -rw-r--r-- 1 oracle oinstall 6032 May 28 10:40 sqlnet.log so here at home directory the "test.o" generated but the problem is i couldnt execute this [oracle@localhost ~]$ ./test -bash: ./test: No such file or directory so why this error arrising |
Quote:
|
Quote:
Could you post the specific error messages you're getting? |
here is the program along with all the commands i used to execute it
The test.cpp file:
#include <iostream> #include <occi.h> using namespace oracle::occi; using namespace std; class testOcci{ private: Environment *env; Connection *conn; Statement *stmt; public: testOcci (string user, string passwd, string db) { env = Environment::createEnvironment (Environment::DEFAULT); conn = env->createConnection( user, passwd,db); } ~testOcci () { env->terminateConnection(conn); Environment::terminateEnvironment (env); } }; int main(void) { string user="scott"; string passwd="tiger"; string db="spdc"; testOcci *demo = new testOcci (user, passwd, db); cout << "Creation Successful" << endl; delete (demo); cout << "Deletion Successful" << endl; return 0; } to find the occi.h file location using find -name occi.h the result is ./oracle/product/10.2.0/client_1/rdbms/public/occi.h to compile the test.cpp program g++ -L/home/oracle/oracle/product/10.2.0/client_1/lib -L/home/oracle/oracle/product/10.2.0/client_1/rdbms/public -I /home/oracle/oracle/product/10.2.0/client_1/rdbms/public -o test.o -c test.cpp this generates 0 bugs, compiles successfully then to make the test.o program make -f /home/oracle/oracle/product/10.2.0/client_1/rdbms/demo/demo_rdbms.mk buildocci EXE=run OBJS=test.o this generates the following error /usr/bin/g++ -L/home/oracle/oracle/product/10.2.0/client_1/lib/ -L/home/oracle/oracle/product/10.2.0/client_1/rdbms/lib/ -o run new.o -locci -lclntsh `cat /home/oracle/oracle/product/10.2.0/client_1/lib/sysliblist` -ldl -lm /usr/bin/ld: warning: libstdc++.so.5, needed by /home/oracle/oracle/product/10.2.0/client_1/lib//libocci.so, may conflict with libstdc++.so.6 then when i use "ls -l" to list the files at the home directory along with its file types the result is -rwxr-xr-x 1 oracle oinstall 478343213 May 21 06:14 10201_client_linux32.zip -rw-r--r-- 1 oracle oinstall 27 May 28 11:04 afiedt.buf drwxr-xr-x 6 oracle oinstall 4096 Jul 2 2005 client drwxr-xr-x 2 oracle oinstall 4096 May 28 10:41 Desktop -rw-r--r-- 1 oracle oinstall 671 May 28 11:20 test.cpp -rw-r--r-- 1 oracle oinstall 5012 May 28 11:23 test.o drwxrwx--- 3 oracle oinstall 4096 May 26 15:03 oracle drwxrwx--- 6 oracle oinstall 4096 May 26 15:06 oraInventory -rwxr-xr-x 1 oracle oinstall 50519 May 28 11:24 run -rw-r--r-- 1 oracle oinstall 6032 May 28 10:40 sqlnet.log so here at home directory the "test.o" generated but the problem is i couldn't execute this [oracle@localhost ~]$ ./test -bash: ./test: No such file or directory |
Quote:
And how many more attempts will it take from you to publish the exact error message(s) which are printed during your attempt to execute ? FWIW, you also need to publish the exact command line you used to execute the stuff. |
now i eddited/excuted and listed the error here
Quote:
hai now check the post i edited and displayed the error which raised at executing time too, please check this. |
Quote:
Code:
[oracle@localhost ~]$ ./test With the lack of elementary knowledge of how things work under a UNIXish system you shouldn't be doing any programming under such systems. Pick any tutorial for Linux newbies and start from there. |
here is some try which i gave
[oracle@localhost ~]$ ./test
-bash: ./test: No such file or directory [oracle@localhost ~]$ ./test.o -bash: ./test.o: Permission denied [oracle@localhost ~]$ chmod +x test.o [oracle@localhost ~]$ ./test.o -bash: ./test.o: cannot execute binary file [oracle@localhost ~]$ ./run Aborted so here have a look still i think the problem yet to solved can you tell me how to execute this file thanks @advance |
Quote:
You need to first understand Linux basics from end user point of view, and then to understand compilation and linking basics. You shouldn't have even started what you are trying to do with your level of expertise. If I or somebody else tell you what and how to execute, you'll have no incentive to learn the needed basics. ... Actually, one of your commands is correct and proper. |
ok look at here i some what find the problem
line 1: testOcci (string user, string passwd, string db) line 2: { line 3: env = Environment::createEnvironment (Environment:EFAULT); line 4: conn = env->createConnection( user, passwd,db); line 5: } at the above snipet using cout statements i some what found the control reaches the end of line3. that is it creating the environment after that for creating connection only generating the ouput as such "Aborted". so now can you help me why this is happen. |
i found the bug and fixed it.
#include <iostream>
#include <occi.h> using namespace oracle::occi; using namespace std; class testOcci{ private: Environment *env; Connection *conn; Statement *stmt; public: testOcci (string user, string passwd, string db) { env = Environment::createEnvironment (Environment::DEFAULT); conn = env->createConnection( user, passwd,db); } ~testOcci () { env->terminateConnection(conn); Environment::terminateEnvironment (env); } }; int main(void) { string user="scott"; string passwd="tiger"; string db="orcl"; // so here was the bug previously i gave "spbc" testOcci *demo = new testOcci (user, passwd, db); cout << "Creation Successful" << endl; delete (demo); cout << "Deletion Successful" << endl; return 0; } |
All times are GMT -5. The time now is 12:38 AM. |