Click here to Skip to main content
13,291,748 members (51,758 online)
Click here to Skip to main content
Add your own
alternative version


14 bookmarked
Posted 22 May 2007

ABCs of Pro*C

, 23 May 2007
Rate this:
Please Sign up or sign in to vote.
Basic understanding of Pro*C


The intention of writing this Pro*C tutorial is to provide basic understanding of the oracle PRO*C precompiler. PRO*C is a useful tool provided by ORACLE to simplify the task of writing complex C program interacting with ORACLE database. (Of course it could be useful with other databases as well.)

Why Pro*C?

The benefits of writing application using Pro*C are as follows:

  • Pro*C facilitates developer to use SQL in application programs to access ORACLE directly.
  • User can create highly flexible user interfaces and integrate involving oracle.
  • Pro*C helps fine tune the application and also allows close monitoring of resource use, SQL statement execution as well as various runtime indicator.
  • Using Pro*C saves time though adds a step in the development process. It translates embedded SQL into the calls to the oracle runtime library (SQLLIB).
  • Pro*C also allows optional sementic check of embedded SQL, analyses host variables and also defines mappings of structure into columns.

Overall Process

The overall process starting from writing Pro*C code to executable is as follows:

  • A Pro*C file can be written using notepad or any ordinary editor with extension .pc containing Pro*C code.
  • Pro*C precompiler takes this example .pc file as an input and generates corresponding .c file. This .c file contains complex code containing corresponding code in C. (For java developers -- its similar to webserver which takes .jsp file as input and generates corresponding complex servlet code.)
  • The generated .c file is needed to be compiled through C compilers with necessary headers and linking
    library in path (e.g. Windows users need to compile in VC++ (or GCC, Borland C, etc. depending upon development tool. and UNIX user through GCC. Ideally path setting needs to be done in configuration files.)
  • User can directly utilize the function call (Written in your Pro*C file) into program by including necessary
    header files in your program.

How is it used generally?

The basic uses of Pro*C are:

  • Pro*C is generally used in large applications which uses C/C++ as a middle tier which contains actual business logic and interaction with database.
  • For small scale systems, all the transaction processing which needed to be performed in C/C++, all functions are preffered to be implemented using Pro*C and generated .dll (.o and/or .so for UNIX) are used while writing front end applications.
  • For business web applications where your business logic needs to be implemented in C. Pro*C is very useful to avoid complex coding as well as user can write extension for other languages such as perl, python depending on the application architecture.


<23-05-2007> First article has been created.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Web Developer
United States United States
Author is a consultant. He is having more than 4 years of experience in designing and developing applications on Windows, UNIX and LINUX paltforms in C, C++ and Perl.

Vipul lives in Annapolis, MD, USA.

You may also be interested in...

Comments and Discussions

GeneralMy vote of 1 Pin
idil1026-Jun-09 0:24
memberidil1026-Jun-09 0:24 
GeneralArchaic Pin
Marc Clifton23-May-07 3:13
protectorMarc Clifton23-May-07 3:13 
GeneralRe: What on earth???? Pin
MrGoodly23-May-07 5:17
memberMrGoodly23-May-07 5:17 
GeneralRe: What on earth???? Pin
yafan23-May-07 6:03
memberyafan23-May-07 6:03 
To be fair:

It could be that the gentleman is a contractor and is working on a legacy project.

Indian software companies do a lot of outsourcing globally and, I imagine, get tasked with working on a lot of legacy systems.

I can't imagine why else you'd advocate using this technique, unless, as you said, they are living in a cave somewhere...

AnswerRe: Archaic Pin
vipulparmar23-May-07 19:03
membervipulparmar23-May-07 19:03 
GeneralRe: Archaic Pin
Richard Blake30-Oct-07 8:10
memberRichard Blake30-Oct-07 8:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.171207.1 | Last Updated 23 May 2007
Article Copyright 2007 by vipulparmar
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid