Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6837325
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:27:49+00:00 2026-05-26T23:27:49+00:00

I am using OCCI to connect Oracle and C++. When i try to access

  • 0

I am using OCCI to connect Oracle and C++. When i try to access all the records in the table(which has 10 records), the following code snippet displays only 4 records from the table and the program ends with “segmentation fault” message.

Table Employee

Name         Null?    Type
 ------------ -------- ---------------
 ID           NOT NULL NUMBER(6)
 NAME         NOT NULL VARCHAR2(30)
 AGE          NOT NULL NUMBER(3)
 SALARY       NOT NULL NUMBER(6)
 VA                    NUMBER(8,2)

Code

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


int main ()
{
   Environment *env;
   Connection *conn;
   string userName ;
   string password ;
   string database ;

   userName="e224312";
   password="ipgdMCicy";
   database="oraconn";

   cout << "OCCI Demo" << endl;

   env=Environment::createEnvironment(Environment::DEFAULT);
   conn=env->createConnection(userName,password,database);

   cout << "OCCI Environment  and Connection Created " << endl;

   int idx=0;
   int ch;
   int c1;
   string c2;

   int c3;  

   Statement *stmt = conn->createStatement("SELECT * FROM employee");
   cout << "Selecting Records from Table " << endl;
   ResultSet *rs = stmt->executeQuery();

   while(rs->next()){
    c1 = rs->getInt(1);
    c2 = rs->getString(2);
    c3 = rs->getInt(3); 
    cout <<"ID   :" << c1 << endl;
    cout <<"Name :" << c2 << endl;
    cout <<"Age  :" << c3 << endl;
   }
   cout << "Terminating the Connection and The Environment" << endl;
   env->terminateConnection(conn);
   Environment::terminateEnvironment(env);

   cout << "Normal End" << endl;
}

I am using unix g++ compiler. What is the reason for this abrupt end of the execution and how can I correct it?

GDP Stack Trace

 ~/project/test> gdb testgdb
GNU gdb Fedora (6.8-37.el5)
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i386-redhat-linux-gnu"...
(gdb) run
Starting program: /home/518377/project/test/testgdb
warning: .dynamic section for "/lib/libm.so.6" is not at the expected address
warning: difference appears to be caused by prelink, adjusting expectations
warning: .dynamic section for "/lib/libc.so.6" is not at the expected address
warning: difference appears to be caused by prelink, adjusting expectations
warning: .dynamic section for "/usr/lib/oracle/10.2.0.4/client/lib/libnnz10.so" is not at the expected address
warning: difference appears to be caused by prelink, adjusting expectations
warning: .dynamic section for "/lib/libdl.so.2" is not at the expected address
warning: difference appears to be caused by prelink, adjusting expectations
warning: .dynamic section for "/lib/libpthread.so.0" is not at the expected address
warning: difference appears to be caused by prelink, adjusting expectations
warning: .dynamic section for "/lib/libnsl.so.1" is not at the expected address
warning: difference appears to be caused by prelink, adjusting expectations
[Thread debugging using libthread_db enabled]
OCCI Demo
[New Thread 0xb7fe08e0 (LWP 32385)]
OCCI Environment  and Connection Created
Selecting Records from Table
Emp Id   :7
Emp Name :Arun
Age      :23
Emp Id   :8
Emp Name :Babu
Age      :25
Emp Id   :9
Emp Name :Catherine
Age      :21
Emp Id   :10
Emp Name :Dinesh
Age      :20

Program received signal SIGSEGV, Segmentation fault.
0x001a09cc in free () from /lib/libc.so.6
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T23:27:49+00:00Added an answer on May 26, 2026 at 11:27 pm

    It is the Problem with g++ compiler. It worked when i used gcc compiler.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to connect to oracle database from c++ using OCCI, I am
CREATE TABLE DIALOGUE_TABLE(EXPIRE_TIME TIMESTAMP); Following code snippet is inside stored proc : PO_EXPIRETIME :-
Using android 2.3.3, I have a background Service which has a socket connection. There's
Using the following database table structure: Order Table: OrderId OrderName OrderItem Table: OrderId ItemId
Using Rails 3.2.0.rc2 and ruby 1.9.3p0 In app/views/requests/_form.html.erb I have the following code for
Using C#, I need a class called User that has a username, password, active
Using preview 4 of ASP.NET MVC Code like: <%= Html.CheckBox( myCheckBox, Click Here, True,
Using the following as an example (with $db being a previously created database connection
Using C++ preprocessor directives, is it possible to test if a preprocessor symbol has
I want to parse strings similar to the following into separate variables using regular

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.