[comp.databases] RDBMS Portability Isses

rubi@lgc.com ( Ernest Rubi) (01/29/91)

Does anyone have any information, experiences, case studies, etc. 
on the issues of developing RDBMS-portable applications using 
embedded SQL and X-Windows? I am particularly interested in 
portability issues between Oracle and Ingres, with additional 
interests in Sybase and Informix. Ideally, I would like to be 
able to take a C program containg embedded SQL and X-Window calls, 
run it through the preprocesssor of whichever RDBMS, and have the 
expectation that the program will function the same regardless of 
the RDBMS. Given the constraints of an industry that has not yet 
achieved this degree of standardization, I am looking for insights 
on how to (as much as possible) effectively and efficiently create 
portable X-Windows applications that can run under multiple RDBMSs. 
I will summarize responses on the net if there is sufficient response 
and interest. Thanks in advance.
 
---
Ernest Rubi			Phone : (713) 579-4789
Landmark Graphics Corp.		Fax   : (713) 579-4814
333 Cypress Run			E-Mail: rubi@lgc.com
Houston, TX  77094

chris@vision.uucp (Chris Davies) (01/30/91)

In article <1991Jan28.180523.28946@lgc.com> rubi@lgc.com ( Ernest Rubi) writes:
>[...]  I am particularly interested in 
>portability issues between Oracle and Ingres, with additional 
>interests in Sybase and Informix. Ideally, I would like to be 
>able to take a C program containg embedded SQL and X-Window calls, 
>run it through the preprocesssor of whichever RDBMS, and have the 
>expectation that the program will function the same regardless of 
>the RDBMS. Given the constraints of an industry that has not yet  [...]

(I cannot comment on the portability of X (although I would expect that to be
not too much of a problem.)

However, for the embedded SQL part - certainly not!  Trivial statements such as
	EXEC SQL SELECT ... INTO :a

might work for both ORACLE and INGRES (but not INFORMIX), but anything more,
including the actual connection to the database, is not truly portable.

I would suggest that the easiest route for you to take is to separate out
the database-specific sections into a separate source module, wrapped up in
your own functions which perform well-defined actions in a generic-looking way.
This way your program can request such things as connection to a database
with generic-looking calls such as

	boolean ConnectToDatabase(ConnStr)
	char *ConnStr;
	{
		/*
		 * Connect to database using db-specific string.  Return
		 * TRUE or FALSE to indicate success (or otherwise).
		 */
		EXEC SQL CONNECT ... ;
	}

This is the route that VisionWare took.  I found it easiest to have a separate
module for each of the databases Ingres, Informix and Oracle, rather than
use constructs such as
	#ifdef ORACLE6
		...
	#else
	#ifdef INGRES6
		...
	#else
	#ifdef INFORMIX4
		...
	#else
	#   error "No database type specified"
	#endif

Hope this is useful,

Chris
-- 
VISIONWARE LTD         | UK: chris@vision.uucp    JANET: chris%vision.uucp@ukc
57 Cardigan Lane       | US: chris@vware.mn.org   BANGNET: ...!ukc!vision!chris
LEEDS LS4 2LE, England | VOICE:  +44 532 788858   FAX:  +44 532 304676
-------------- "VisionWare:   The home of DOS/UNIX/X integration" -------------