LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-27-2010, 05:01 AM   #1
vinodpragadeesh
LQ Newbie
 
Registered: Apr 2007
Posts: 7

Rep: Reputation: 0
Thumbs up 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:cci;
using namespace std;

class testOcci{
private:
Environment *env;
Connection *conn;
Statement *stmt;

public:

testOcci (string user, string passwd, string db)
{
env = Environment::createEnvironment (Environment:EFAULT);
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

Last edited by vinodpragadeesh; 05-28-2010 at 06:20 AM. Reason: now i added the program too please check this
 
Old 05-27-2010, 05:29 AM   #2
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by vinodpragadeesh View Post
...or something.

so can any one help me to solve this problem
Something is wrong with your setup.
 
1 members found this post helpful.
Old 05-27-2010, 07:42 AM   #3
JohnGraham
Member
 
Registered: Oct 2009
Posts: 467

Rep: Reputation: 139Reputation: 139
Quote:
Originally Posted by vinodpragadeesh View Post
8. when i tried to run the object file it throughs error as such linker file conflicts or duplicates or something.
That's not very useful - you may as well have just said "something's wrong".

Could you post the specific error messages you're getting?
 
1 members found this post helpful.
Old 05-28-2010, 01:06 AM   #4
vinodpragadeesh
LQ Newbie
 
Registered: Apr 2007
Posts: 7

Original Poster
Rep: Reputation: 0
Question 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:cci;
using namespace std;

class testOcci{
private:
Environment *env;
Connection *conn;
Statement *stmt;

public:

testOcci (string user, string passwd, string db)
{
env = Environment::createEnvironment (Environment:EFAULT);
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

Last edited by vinodpragadeesh; 05-28-2010 at 01:48 AM.
 
Old 05-28-2010, 01:22 AM   #5
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by vinodpragadeesh View Post
...
so here at home directory the "test.o" generated but the problem is i couldn't execute this
Did you try to execute 'test.o' file ?

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.
 
Old 05-28-2010, 01:50 AM   #6
vinodpragadeesh
LQ Newbie
 
Registered: Apr 2007
Posts: 7

Original Poster
Rep: Reputation: 0
now i eddited/excuted and listed the error here

Quote:
Originally Posted by Sergei Steshenko View Post
Did you try to execute 'test.o' file ?

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.


hai now check the post i edited and displayed the error which raised at executing time too,

please check this.
 
Old 05-28-2010, 02:11 AM   #7
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by vinodpragadeesh View Post
hai now check the post i edited and displayed the error which raised at executing time too,

please check this.

Code:
[oracle@localhost ~]$ ./test
-bash: ./test: No such file or directory
This is a UNIXish system, so file extension does matter. A file called 'test' does not exist in current directory, so 'bash' is correct.

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.
 
Old 05-28-2010, 05:39 AM   #8
vinodpragadeesh
LQ Newbie
 
Registered: Apr 2007
Posts: 7

Original Poster
Rep: Reputation: 0
Question 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

Last edited by vinodpragadeesh; 05-28-2010 at 05:51 AM.
 
Old 05-28-2010, 05:57 AM   #9
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by vinodpragadeesh View Post
[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
You have no clue; start learning; as I've written, pick any website for Linux newbies.

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.
 
Old 05-28-2010, 06:05 AM   #10
vinodpragadeesh
LQ Newbie
 
Registered: Apr 2007
Posts: 7

Original Poster
Rep: Reputation: 0
Question

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.
 
Old 05-28-2010, 06:18 AM   #11
vinodpragadeesh
LQ Newbie
 
Registered: Apr 2007
Posts: 7

Original Poster
Rep: Reputation: 0
Lightbulb i found the bug and fixed it.

#include <iostream>
#include <occi.h>
using namespace oracle:cci;
using namespace std;

class testOcci{
private:
Environment *env;
Connection *conn;
Statement *stmt;

public:

testOcci (string user, string passwd, string db)
{
env = Environment::createEnvironment (Environment:EFAULT);
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;
}
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Regding oracle10g installation vamsi_k Linux - Newbie 4 11-27-2008 04:39 PM
X desktop effects not working on FC 6 - can anybody solve this? deepumnit Linux - Desktop 1 04-07-2007 03:21 PM
root-tail working only in rootGUI. window id option in user mode does not solve issue Emmanuel_uk Linux - Newbie 3 11-16-2005 01:04 AM
oracle10g on slack10? zord Slackware 6 05-20-2005 08:51 PM
FC3+Oracle10g freeze poj Linux - Software 7 05-12-2005 12:54 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:28 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration