Re: c program against databases

From: Nils Myklebust <Nils.Myklebust_at_idg.no>
Date: 1997/03/16
Message-ID: <332bff71.1750196_at_gate.idg.no>#1/1


I would do everything in my power to avoide caos like this. If the ANSI/CLI solutions work well (Informix CLI, OpenLink UDBC or some other alternative) that seems so much better.

  1. You would be able to relate to 1 connectivity library only for all databases.
  2. The connectivity library will handle conversion of all simple sql statements to whatever each database requires so you can, at this level, relate to one standard set of sql commands whatever engine you run against.
  3. If you find you need to utilize special extentions to sql from different wendors you can handle that by passing such statements directly through to the engine without translations by the driver.

If the above works well, and there is every reason to believe it does, isn't there, it seems like a different world compared to embedded sql. The embedded sql solution seems to me more or less like writing your own version of that which the ANSI/CLI libraries allready handls for you.

David Williams <djw_at_smooth1.demon.co.uk> wrote:

:In article <33287792.3C6D_at_ventera.com>, "Lan H. Tran"
:<lantran_at_ventera.com> writes
:>hello,
:>i would like to write a unix-based c program that would perform SELECT
:>and INSERT against a database. i am very familiar with esql/c.
:>however, i would like to productize this program and allow it to work
:>with a variety of databases (Informix, Oracle, Sybase, DB2) on a variety
:>of operating systems (variations of unix and NT, maybe).
:>
:>is the best way to write embedded sql c code (and recompile using
:>esql/c, pro*c, etc...)? how standard is this? is there a good toolkit
:>to help me out? is there a good book or website to learn more? how do
:>app dev packages like IEF do it?
:>
:
: Someone where I work has written ESQL/C code which can also be
: compiled against Oracle Pro/C using #define ORACLE / #INFORMIX
: and #ifdef's. It was relatively easy.
:
: You could probably write a small libary to handle
:
: 1. Connect to database.
: 2. Disconnect from database.
: 3. Run insert/update/delete against database - these can be stored
: in C strings and prepared - they return a status code.
:
: 2. Run select against database
:
: Can be prepared relatively easily.
:
: 3. Fetch values that are selected.
:
: Not tried (and the hardest bit) since you need to handle variable
: numbers of return values.
:
:
: Conclusion: ESQL/C is the way to go for Oracle/Informix (and Ingres as
: I have written Ingres ESQL/C. Sybase has it's own toolkit so it maybe
: harder to write for.
:
:
:
:>it seems like i would have to buy alot of precompilers. for example, 4
:>databases running on 5 platforms would require 20 (4 x 5) esql/c like
:>compilers. is this true?
:>
:>i would appreciate any guidance.
:>
:>Lan H. Tran
:>Ventera Corporation
:>lantran_at_ventera.com
:--
:David Williams

Nils.Myklebust_at_idg.no
NM Data AS, P.O.Box 9090 Gronland, N-0133 Oslo, Norway My opinions are those of my company
The Informix FAQ is at http://www.iiug.org Received on Sun Mar 16 1997 - 00:00:00 CET

Original text of this message