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

Home -> Community -> Usenet -> c.d.o.tools -> Re: running c++ program within database

Re: running c++ program within database

From: dhmac <dhmac_atl_at_altavista.com>
Date: Sat, 2 Jun 2001 12:12:32 -0400
Message-ID: <9fb373$bqn$1@slb7.atl.mindspring.net>

I would recommend converting the SQL inside your C++ program to PL/SQL Stored Procedures or Stored Functions. Your C++ program can call these SPs or SFs, which will then be inside the database and, hence, do your processing entirely within the database. They then can return results back to your C++ program, if needed (NOTE: you'll need to use Reference Cursors if you need multi-row Resultsets returned to your program).

So, first, study up on PL/SQL to see if it fits your needs. It's a clean, high-level language that adds structured programming features to standard SQL, so it's fairly easy to pick up. And, yes, using it will probably require changing your code a good bit, because you'll be moving some processing from inside your program to inside the database itself (i.e. you'll need to convert some of your structured C++ processing code to structural PL/SQL processing code).

<davidchantf_at_hotmail.com> wrote in message news:2JOR6.1277$Zy.1232642_at_newsrump.sjc.telocity.net...
> Hi,
> I am using oracle ODBC 8.01.72, VC++ 6.0 on winnt 4.0. I have one
> operation that needs about 20*x database access, where x can be from 5 to 30.
> I can set up the program and database in one computer, but still
> slow. Right now I only have hundreds of records for testing, but in
> production mode, it can grow to millions of records.
> And the table design is complex and highly normailized.
> I never try to use PL/SQL, Is it a much better choice than ODBC ? Do I
> need to rewrite my program at all ?
> Thanks.
> David
>
> wayne <no_at_email.please.com> wrote:
> >> I have a C++ program that need to make a lot of database access within
 one
> >> operation, which is very slow. So I am wondering if I can run this program
> >> inside database? so to reduce the number of database access, and increase
> >> performance.
 

> > First of all, you would need to access the database anyway, regardless of
> > whether it's running on the database or outside.
 

> > Now, as far as performance optimization, there are lots of things you could
> > do: Server-side tweaks as well as client-side... you can also scrutinize the
> > design of both the server and the overall process...
 

> > In answer to your question, I have never seen a C++ program be part of the
> > database itself. You can call out from the PL/SQL to the C++, but the C++
> > would have to be an external module (and may have to have a C wrapper,
> > possibly), as in a DLL or SO file.
 

> > What would I do at this point if I were you (and I _have_ been in your
> > situation before)? I would start with the overall design. Minor tweaks do
> > not help if the underlying design is bad. I would then move on to
> > optimizing the server and the client code (and what I would do depends
> > heaviliy on what the exact tasks are and how long each takes to run).
 

> > If you describe your project more we can help more (ie. what operations are
> > being dome that take a long time, how many records are we talking about,
> > what platform you run in, whether or not you are already running the program
> > on the same machine as the server, etc...).
>
>
Received on Sat Jun 02 2001 - 11:12:32 CDT

Original text of this message

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