[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Oracle C++ library

Posted on 2004-09-25
9
Medium Priority
?
996 Views
Last Modified: 2013-12-12
hi friends,
              I want to access oracle database through C++ i.e i want to make connection create,delete and access different tables.
              When i installed oracle server on linux i have some demo codes already provided by oracle.
              First these code is not executing because of some library is not present(undefined reference)
               Secondly  Do i require a oracle client to install
               Will you  please give some source codes for oracle connection and accessing database
thanx in advance
0
Comment
Question by:jassy_shah
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +1
9 Comments
 
LVL 7

Expert Comment

by:BobMc
ID: 12172995
If you want to access an Oracle database, the simplest way is to use the OCCI for C++.
This should be an option when you install the Oracle client.

Typical use is (pulled straight from the Oracle docs)

const string userName = "SCOTT";
const string password = "TIGER";
const string connectString = "";

Environment *env = Environment::createEnvironment();
{
   Connection *conn = env->createConnection(userName, password, connectString);
   Statement *stmt = conn->createStatement("SELECT blobcol FROM mytable");
   ResultSet *rs = stmt->executeQuery();
   rs->next();
   Blob b = rs->getBlob(1);
   cout << "Length of BLOB : " << b.length();
   .
   .
   .
   stmt->closeResultSet(rs);
   conn->terminateStatement(stmt);
   env->terminateConnection(conn);
}
Environment::terminateEnvironment(env);
0
 
LVL 11

Expert Comment

by:mohammadzahid
ID: 12174842
Yes, you need atleast Oracle client installed on the system from where you are making connection and have the oci libraries defined on that box.
If oci libraries are not defined then you will get errors at the linking stage. Please refer to Oracle Technology Network site and download Oracle OCI C++ Guide.

0
 

Author Comment

by:jassy_shah
ID: 12206735
Yes i do appreciate ur comments
The programs which i am executing are present on the server itself so i dont think so i require a oracle client installed this is because i already have OCCI library when i install server.
 
        Suppose i install oracle client whether oracle libraries will also be installed with that. Also i am installing client on server itself.
0
Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

 
LVL 7

Expert Comment

by:BobMc
ID: 12207280
Yes, you should install a separate client on your server, so you can patch the application interface without affecting your database in the future.

You should get an option to install the libraries with the client  - either via the custom install, or the programme one (cant remember the actual name)
0
 
LVL 11

Expert Comment

by:mohammadzahid
ID: 12210211
Please verify the server library path that it contains the correct location of the OCI libraries.

Please provide some more details:

- Oracle database version?
- C++ environment (Example : Visual C++, etc...) ?
- Server operating system?
- Client operating system?


0
 

Author Comment

by:jassy_shah
ID: 12234936
Oracle version:9i
C++ environment on Linux platform
client and server (redhat linux 9.0)

0
 
LVL 11

Expert Comment

by:mohammadzahid
ID: 12235008
Does the library path contain correct path where Oracle libraries are located?
On linux what C++ IDE are you using to program, compile and link your program to Oracle database?



0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 12511950
PAQed - no points refunded (of 50)

modulo
Community Support Moderator
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
Shell script to create broker configuration file using current broker Configuration, solely for purpose of backup on Linux. Script may need to be modified depending on OS-installation. Please deploy and verify the script in a test environment.
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question