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

ABCs of Pro*C

, 23 May 2007 CPOL
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)

Share

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 
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 
Its great to get feedback from a developer like mark clifton.
 
Yes Mark, I am using Pro*C to write business logic in my system and these set of functions can be called using a service daemon running on a server which can be requested through variety of frameworks and systems through RPC. As in a large system we utilize it even today. And for your information, there exists lots of system where Pro*C is essentially required and there is no need to create generic implementation as we only use ORACLE and will use it in future as well. Smile | :)
 
The intention behind writing this article is, everytime a developer not allowed to draft system. They need to work with existing system implementation as I have faced that there are no such good articles on net for Pro*C so I initiated to write a series as this is a first introductory article.
 


 
Thanks,
Vipul

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.141015.1 | Last Updated 23 May 2007
Article Copyright 2007 by vipulparmar
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid