Hello everybody,
I started coding my server written in C++ on Microsoft Windows
platform using Pro*C++ embedded sql because I was told that it
is very easy to code interface for accessing Oracle data.
And now I'm repenting I did that. I think, I'll need to
recode everything using OCI after almost 2 months of efforts.
It's extremely frustrating to work with Pro*C++. I will not
advice anybody to use Pro*C++ with multithreading unless of
course somebody already knows answers to the problems I'm
facing. Here are some problems I am facing at the moment.
- First and the biggest problem is it does not understand
C++ program structure at all. If you want to write C++ programs
you need to add code=cpp as preprocessor option. As soon as you
do that the default option parse=partial has to be added. If
you do that you preprocessor does not understand variables
defined outside EXEC SQL DECLARATION SECTION BEGIN and END
statements. That means that I cannot include private variables
of the class used as host variables. (Cool!)
- Then Pro*C++ preprocessor after preprocessing creates lots
of global variables in the file. So we need to put all the
EXEC SQL statements only in one .cpp file. Because otherwise
we get compilation errors saying that same global variables
are defined at multiple places.
- Since every host variable needs to be defined between
EXEC SQL DECLARATION SECTION BEGIN and END statements you
cannot even pass host variables as arguments to the functions.
- Sometimes there are ugly work arounds possible. But that
makes your code look really really ugly. To give an example,
since you cannot define a argument variable to be used as a
host variable you can pass in a variable and then copy it
into a variable defined between EXEC SQL DECLARATION SECTION
BEGIN and END. Or since you cannot define a private class
variable as an host variable, define a local variable in
EXEC SQL DECLARATION SECTION BEGIN and END in EACH method
and copy the private variable into it.
- Most of the example programs given in Oracle documentation
are written using C and NOT C++. So they do not address all
the problems mentioned above at all. Hence the documentation
is pretty much useless in many cases.
- It's extremely difficult to get any help for the problems.
I tried to post messages in newsgroups. No answers. Many
times people just ask me to contact Oracle customer support.
If I search in Oracle metalinks database, many of the problems
are reported as bugs. And if they are not, then there are
really ugly work arounds available which may not even be
practical to do (For the problem I was facing it was suggested
that declaration of cursor, opening of cursor and fetching
should be done in one function or method! What if I cannot
do that?!!!).
- When I contacted Oracle customer support, all they keep
saying is upgrade to the next version. In our case, we have
about 500 customer sites. If we want to upgrade all of these
sites its quite a project in itself!
Pro*C++ is the first Oracle product I started using and I must
say I'm not impressed with it. I'm writing this post hoping
that somebody still has answers to all these questions otherwise
they know what kind of problems will they be facing using Pro*C++.
I wish I had seen an article like this before I stared.
Atul
Received on Wed Oct 31 2001 - 12:45:37 CST