dbTalk Databases Forums  

Embedded SQL

comp.databases.ibm-db2 comp.databases.ibm-db2


Discuss Embedded SQL in the comp.databases.ibm-db2 forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Tomasz
 
Posts: n/a

Default Embedded SQL - 08-14-2003 , 02:19 AM






Hi all
We plan to write large application (sales, purchase, accounting) in C/C++.
It will work with DB2 and other databases (MS SQL and Oracle). Client will
work under Win and Linux, so ADO and OLE DB aren't solution.
It seems ESQL standard is the only solution that allows to write such
application once and connect to different databases. Is this good choice? Is
this fit for serious application? Will it be supported in the future?
In your opinion, which API would be the best solution?

your help would be greatly appreciated
Tomasz




Reply With Quote
  #2  
Old   
Larry
 
Posts: n/a

Default Re: Embedded SQL - 08-14-2003 , 07:58 AM






Depends upon whether your SQL is static or not. And ... I don't believe MS or
Oracle support embedded SQL. You may want to take a more dynamic approach and
look at the CLI interface.

Larry Edelstein

Tomasz wrote:

Quote:
Hi all
We plan to write large application (sales, purchase, accounting) in C/C++.
It will work with DB2 and other databases (MS SQL and Oracle). Client will
work under Win and Linux, so ADO and OLE DB aren't solution.
It seems ESQL standard is the only solution that allows to write such
application once and connect to different databases. Is this good choice? Is
this fit for serious application? Will it be supported in the future?
In your opinion, which API would be the best solution?

your help would be greatly appreciated
Tomasz


Reply With Quote
  #3  
Old   
Jiang Qingshuang
 
Posts: n/a

Default Re: Embedded SQL - 08-14-2003 , 09:30 AM



DB2 Federated Database Technology provides the mechanism of
integrating multiple data sources.
http://www-900.ibm.com/developerWork...haas_eng.shtml

"Tomasz" <rn55 (AT) nospam (DOT) wp.pl> wrote

Quote:
Hi all
We plan to write large application (sales, purchase, accounting) in C/C++.
It will work with DB2 and other databases (MS SQL and Oracle). Client will
work under Win and Linux, so ADO and OLE DB aren't solution.
It seems ESQL standard is the only solution that allows to write such
application once and connect to different databases. Is this good choice? Is
this fit for serious application? Will it be supported in the future?
In your opinion, which API would be the best solution?

your help would be greatly appreciated
Tomasz

Reply With Quote
  #4  
Old   
Hemant Shah
 
Posts: n/a

Default Re: Embedded SQL - 08-14-2003 , 09:51 AM



While stranded on information super highway Tomasz wrote:
Hi all
We plan to write large application (sales, purchase, accounting) in C/C++.
It will work with DB2 and other databases (MS SQL and Oracle). Client will
work under Win and Linux, so ADO and OLE DB aren't solution.
It seems ESQL standard is the only solution that allows to write such
application once and connect to different databases. Is this good choice? Is
this fit for serious application? Will it be supported in the future?
In your opinion, which API would be the best solution?

your help would be greatly appreciated
Tomasz


I am in process of porting our application from DB2 to Oracle. We
use embedded SQL and it is relatively easy to port from one database to
another as long as you do not use LOBs, and make sure that the date/time
settings are same across the database so you can specify date/time in one
format (e.g. YYYY-MM-DD). We use LOBs and VARCHARS which require some
tweaking of the code. If you use "FOR FETCH ONLY" or "FOR READ ONLY" in
DB2 SELECT statements then you will have to change the code because
ORACLE does not support "FOR FETCH ONLY" and "FOR READ ONLY".

Try to stick to SQL92 standard and it will be easy to port.

DB2 and Oracle has precompiler that converts ESQL to C function calls.

If you use CLI then each database has different Call Level Interface,
I did not find any similarity between Oracle and DB2, and you know Microsoft will
be different than rest of the world. I believe MS SQL also has ESQL
precompiler.






--
Hemant Shah /"\ ASCII ribbon campaign
E-mail: NoJunkMailshah (AT) xnet (DOT) com \ / ---------------------
X against HTML mail
TO REPLY, REMOVE NoJunkMail / \ and postings
FROM MY E-MAIL ADDRESS.
-----------------[DO NOT SEND UNSOLICITED BULK E-MAIL]------------------
I haven't lost my mind, Above opinions are mine only.
it's backed up on tape somewhere. Others can have their own.

Reply With Quote
  #5  
Old   
Blair Adamache
 
Posts: n/a

Default Re: Embedded SQL - 08-14-2003 , 09:55 AM



Most applications these days are being written with stored procedures,
not embedded SQL.

Tomasz wrote:

Quote:
Hi all
We plan to write large application (sales, purchase, accounting) in C/C++.
It will work with DB2 and other databases (MS SQL and Oracle). Client will
work under Win and Linux, so ADO and OLE DB aren't solution.
It seems ESQL standard is the only solution that allows to write such
application once and connect to different databases. Is this good choice? Is
this fit for serious application? Will it be supported in the future?
In your opinion, which API would be the best solution?

your help would be greatly appreciated
Tomasz





Reply With Quote
  #6  
Old   
PM \(pm3iinc-nospam\)
 
Posts: n/a

Default Re: Embedded SQL - 08-14-2003 , 10:33 AM



CLI is DB2 only right?
For multiple dbms that would be ODBC right? (ODBC is similar to CLI.)

PM

"Larry" <lsedels (AT) us (DOT) ibm.com> a écrit dans le message de
news:3F3B8790.6EAB0EB8 (AT) us (DOT) ibm.com...
Quote:
Depends upon whether your SQL is static or not. And ... I don't believe MS
or
Oracle support embedded SQL. You may want to take a more dynamic approach
and
look at the CLI interface.

Larry Edelstein

Tomasz wrote:

Hi all
We plan to write large application (sales, purchase, accounting) in
C/C++.
It will work with DB2 and other databases (MS SQL and Oracle). Client
will
work under Win and Linux, so ADO and OLE DB aren't solution.
It seems ESQL standard is the only solution that allows to write such
application once and connect to different databases. Is this good
choice? Is
this fit for serious application? Will it be supported in the future?
In your opinion, which API would be the best solution?

your help would be greatly appreciated
Tomasz




Reply With Quote
  #7  
Old   
Wolfgang Riedel
 
Posts: n/a

Default Re: Embedded SQL - 08-14-2003 , 11:27 AM



Tomasz wrote:
Quote:
Hi all
We plan to write large application (sales, purchase, accounting) in C/C++.
It will work with DB2 and other databases (MS SQL and Oracle). Client will
work under Win and Linux, so ADO and OLE DB aren't solution.
It seems ESQL standard is the only solution that allows to write such
application once and connect to different databases. Is this good choice? Is
this fit for serious application? Will it be supported in the future?
In your opinion, which API would be the best solution?

your help would be greatly appreciated
Tomasz
Hi Thomasz,

We have done this (Oracle, Informix, Db2 and Watcom) (don't know about MS SQL),
works fine, but you have to look out for some differences in native/sql-mappings
f.e. Oracle maps varchar to struct, db2 and informix to char* or [], returncodes,
sqlcodes will be different, so will be includes and global(!) vars, needed casts
in SQL, format (and name!) of parameter markers, input indicator variables,
filescope-uniqueness of local (ora!) function variablenames etc.

As your application, like ours, will only connect to on db-system (I suppose), a
own
preprocessing of source and headers to generate db-specific files should give you
better results than odbc.

And btw., dynamic ESQL works fine with all of them, all you have to do, is a
EXEC SQL PREPARE <statement> FROM :<var>

hth,
Wolfgang


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.