Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: [Newbie] howto: accessing Oracle SQL by C/C++ Win32 Application

Re: [Newbie] howto: accessing Oracle SQL by C/C++ Win32 Application

From: Tom Barnes <nospam1978_at_yahoo.com>
Date: 2 Dec 2004 17:02:04 -0800
Message-ID: <5af28966.0412021702.1e726ef6@posting.google.com>


"Rainer Hausbach" <R.Hausbach_at_d-offline.de> wrote in message news:<coi2ou$168$1_at_mail1.sbs.de>...
> Hi Oracle gurus,
>
> I'am a little bit confused about the various ways to connect/interact with
> an Oracle SQl Database.
> Some years ago ( > 8), I did write an Application running under WfW 3.11
> connecting to a Novell NetWare 3.12 based Oracle 7.0.x Server.
> I was using a Pre Compiler Pro*C(?) v1.5 to produce C code which could be
> used with MS VC 1.51 / MFC 2.5 environment (those where the days...)
>
> Now: How to do this kind of tasks in a 'modern' Windows 32 bit environment?
> (VC 6/7, XP, Oracle v9.x / 10.x).
> I need to connet to some tables (select,update,insert) _and_ to the
> DBMS_PIPE facilites. What is the best Approach to this Task? PL/SQL ->
> 'Native Application Development'?
> Newer Version Pro*C? ODBC? ADO? DOA? COM??

If you are starting a new project on a Windows platform I would strongly recommend you use .NET and C# instead of VC. Sure, C# might be a tad slower than C/C++ but if you are interacting with a database then the speed difference between C# and C/C++ will be negligible - the database interactions will be your bottleneck (there are obviously exceptions to this). C# is a great language and it is easy to learn, I think you will be much more productive in it compared to with C/C++.

No matter what programming language and database connection method you use I also strongly recommend that you encapsulate all database interactions in the same module. This might lead to slightly more code but maintenance will be much easier. It is also more flexible if you decide to change connection method or even database, you won't have to hunt through the whole app to change database code.

Unless it is likely that you will support other databases than Oracle (or dump Oracle all together) I recommend you write PL/SQL procedures/functions for all your database operations. It will give you better performance and "type checking" (ie you can only use tables/columns that actually exists in the database). Interacting with the database by calling PL/SQL is also more flexible in that you can more easily switch from say using ADO to Pro*C. It will also allow (future) external systems to interact with your database and follow the same data logic as your app.

I would use ADO/OLE DB regardless if you're using C# or C/C++. It is much easier to use than say Pro*C and OCI. I didn't know anything about ADO but it took me only an hour to build a test app in VC++ that called my existing PL/SQL procedures. Needless to say, it didn't take me an hour to get started with OCI...

Regarding DBMS_PIPE, I believe this was used much more in the past. Oracle now has features (External Procedures etc) that might alleviate your need for DBMS_PIPE. Anyhow, if you just put your DBMS_PIPE logic in PL/SQL you'll be able to use it regardless if you're using Pro*C/ODBC/ADO/etc.

So in summary, my recommendation would be to use C#, OLE DB, and a lot of PL/SQL. Received on Thu Dec 02 2004 - 19:02:04 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US