Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: help with application development
Lan H. Tran wrote:
>
> 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).
<snip>
One way to hide the database from your c program is to use a library of generic functions to access the data (prepare, fetch or select, close, etc.). Then you code one set of library routines for each database (one for oracle, one for informix, etc.) and link in the appropriate one for the database you want. That way the program doesn't change. If you use shared libraries you could switch databases at run time. And yes, you would need one library for each unique combination of O/S and database, although some might be compatible (e.g. Solaris 2.3, 2.4 and 2.5 might be able to use the same library). I doubt if you can write generic SQL that can be compiled by multiple products that will work effectively. This method allows you to take advantage of each database's features independently, but does produce a lot of code to manage.
-- --- Allen Kirby AT&T ITS Production Services akirby_at_att.com Alpharetta, GA.Received on Mon Mar 17 1997 - 00:00:00 CST