Click here to Skip to main content
Click here to Skip to main content

ABCs of Pro*C

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

Introduction

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.

History

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

License

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

About the Author

vipulparmar
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.

Comments and Discussions

 
GeneralMy vote of 1 Pinmemberidil1025-Jun-09 23:24 
GeneralArchaic PinprotectorMarc Clifton23-May-07 2:13 
Wow. I feel like I've gone through a time warp. The last time I even thought about Pro*C was is the late 1980's. Are you actually using this antiquated technology? Are you actually writing code that lets you so easily entangle data access in your UI and business layers? Are you actually using a technology that is not portable to any other database or platform? Unsure | :~
 
Marc
 

 

Thyme In The Country

Interacx

People are just notoriously impossible. --DavidCrow
There's NO excuse for not commenting your code. -- John Simmons / outlaw programmer
People who say that they will refactor their code later to make it "good" don't understand refactoring, nor the art and craft of programming. -- Josh Smith


GeneralRe: What on earth???? PinmemberMrGoodly23-May-07 4:17 
GeneralRe: What on earth???? Pinmemberyafan23-May-07 5:03 
AnswerRe: Archaic Pinmembervipulparmar23-May-07 18:03 
GeneralRe: Archaic PinmemberRichard Blake30-Oct-07 7:10 

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

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

| Advertise | Privacy | Mobile
Web01 | 2.8.140718.1 | Last Updated 23 May 2007
Article Copyright 2007 by vipulparmar
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid