Re: c program against databases
Posted in 1997
In article <332bff71.1750196@gate.idg.no>, Nils Myklebust <Nils.Myklebust@idg.no> writes >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. > Agreed, I assumed the person wants to write their own version.... > >David Williams <djw@smooth1.demon.co.uk> wrote: > >:In article <33287792.3C6D@ventera.com>, "Lan H. Tran" >:<lantran@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@ventera.com >:-- >:David Williams > >Nils.Myklebust@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 -- David Williams