Embedded SQL: Difference between revisions

Content deleted Content added
Rescuing 1 sources and tagging 0 as dead.) #IABot (v2.0.9.5) (Whoop whoop pull up - 21816
 
(77 intermediate revisions by 50 users not shown)
Line 1:
{{short description|Computer programming method}}
'''Embedded SQL''' is a method of combining the [[computing]] power of a [[programming language]] and the [[database]] [[Data Manipulation Language|manipulation]] capabilities of [[SQL]]. Embedded SQL [[statement (programming)|statements]] are SQL statements written inline with the program [[source code]] of the host language. The embedded SQL statements are [[parsing|parsed]] by an embedded SQL [[preprocessor]] and replaced by host-language [[call site|calls]] to a code [[library (computing)|library]]. The output from the preprocessor is then compiled by the host [[compiler]]. This allows programmers to embed SQL statements in programs written in any number of languages such as: [[:Category:C programming language family|C/C++]], [[COBOL]] and [[Fortran]].
'''Embedded SQL''' is a method of combining the [[computing]] power of a [[programming language]] and the [[database]] [[Data Manipulation Language|manipulation]] capabilities of [[SQL]]. Embedded SQL [[statement (programming)|statements]] are SQL statements written inline with the program [[source code]], of the host language. The embedded SQL statements are [[parsing|parsed]] by an embedded SQL [[preprocessor]] and replaced by host-language [[call site|calls]] to a code [[library (computing)|library]]. The output from the preprocessor is then compiled by the host [[compiler]]. This allows programmers to embed SQL statements in programs written in any number of languages such as [[:Category:C programming language family|C/C++]], [[COBOL]] and [[Fortran]]. This differs from SQL-derived programming languages that don't go through discrete preprocessors, such as [[PL/SQL]] and [[Transact-SQL|T-SQL]].
 
The [[ANSI]] SQL standards committee defined the embedded SQL standard in two steps: a formalism called '''[[Module SQL|Module Language''']] was defined, then the embedded SQL standard was derived from Module Language.<ref name="modulelang">
{{cite web
|url=http://download.oracle.com/docs/cd/B10501_01/appdev.920/a58231/ch1.htm#2889
Line 8 ⟶ 9:
|publisher=[[Oracle Corporation]]
|accessdate=2008-07-14}}
</ref> The SQL standard defines embedding of SQL as ''embedded SQL'' and the language in which SQL queries are embedded is referred to as the ''host language''. A popular host language is C. TheHost mixedlanguage C and embedded SQL, for example, is called [[Pro*C]] in [[Oracle Database|Oracle]] and [[Sybase]] database management systems., InESQL/C thein [[PostgreSQLInformix]], database management system this precompiler is calledand [[ECPG]]. Otherin embeddedthe SQL precompilers are Pro*[[Ada (programming language)|AdaPostgreSQL]], Pro*COBOL,database Pro*FORTRAN,management Pro*[[Pascal (programming language)|Pascal]], and Pro*[[PL/I]]system.
SQL may also be embedded in languages like PHP etc.
 
The SQL standard [[SQL:2023]] is available through purchase and contains chapter '''21 Embedded SQL''' and its syntax rules.<ref>{{cite web
== Systems that support Embedded SQL ==
|url=https://www.iso.org/standard/76584.html
=== IBM DB2 ===
|title=SQL Standard 2023 Chapter 21 Embedded SQL
[[IBM DB2]] version 9 for Linux, UNIX and Windows supports embedded SQL for C, C++, Java, COBOL, FORTRAN and REXX although support for FORTRAN and REXX has been deprecated.<ref>{{cite web
|work=ISO/IEC 9075-2:2023 Information technology — Database languages — SQL — Part 2: Foundation (SQL/Foundation)
|publisher=[[ISO]]
|accessdate=2023-08-17
}}</ref>
 
== Database systems that support embedded SQL ==
 
=== Altibase ===
; C/C++
: APRE is an embedded SQL precompiler provided by [[Altibase]] Corp. for its DBMS server.
 
=== IBM Db2 ===
[[IBM Db2]] for Linux, UNIX and Windows supports embedded SQL for C, C++, Java, COBOL, FORTRAN and REXX although support for FORTRAN and REXX has been deprecated.<ref>{{cite web
|url=http://publib.boulder.ibm.com/infocenter/db2luw/v9/index.jsp?topic=/com.ibm.db2.udb.apdv.embed.doc/doc/c0007014.htm
|title=DB2 Database for Linux, UNIX and Windows
Line 20 ⟶ 35:
}}</ref>
 
=== OracleIBM CorporationInformix ===
[[IBM Informix]] version 14.10 for Linux, Unix, and Windows supports embedded SQL for C. <ref>{{cite web|url=https://www.ibm.com/support/knowledgecenter/SSGU8G_14.1.0/com.ibm.esqlc.doc/esqlc.htm|title=Informix Dynamic Server
; Ada : '''Pro*Ada''' was officially desupported by [[Oracle Corporation|Oracle]] in version 7.3. Starting with Oracle8, Pro*Ada has been replaced by SQL*Module but appears to have not been updated since.<ref>{{cite web
|work=IBM® Informix® ESQL/C
|publisher=[[IBM]]
|accessdate=2020-03-31
}}</ref>}
 
=== Microsoft SQL Server ===
; C/C++
: Embedded SQL for C has been deprecated as of [[Microsoft SQL Server]] 2008 although earlier versions of the product support it.<ref>{{cite web
|url=http://msdn.microsoft.com/en-us/library/ms143729.aspx
|title=Deprecated Database Engine Features in SQL Server 2008
|work=SQL Server 2008 Books Online (March 2009)
|publisher=[[Microsoft]]
|accessdate=2009-04-10
}}</ref>
 
=== Mimer SQL===
[[Mimer SQL]] for Linux, [[macOS]], [[OpenVMS]] and Windows support embedded SQL.<ref>{{cite web
|url=https://docs.mimer.com/MimerSqlManual/latest/Manuals/Embedded_SQL/Embedded_SQL.htm
|title=Embedded SQL|publisher=[[Mimer SQL]]
|work=Mimer SQL Programmer's Manual latest version, Embedded SQL}}</ref>
; C/C++
: Embedded SQL for C/C++ is supported on Linux, macOS, OpenVMS and Windows.
; COBOL
: Embedded SQL for COBOL is supported on OpenVMS.
; Fortran
: Embedded SQL for Fortran is supported on OpenVMS.
 
=== Oracle Database ===
; [[Ada (programming language)|Ada]]
: Pro*Ada was officially desupported by [[Oracle Corporation|Oracle]] in version 7.3. Starting with Oracle8, Pro*Ada was replaced by SQL*Module but appears to have not been updated since.<ref>{{cite web
|url=http://download.oracle.com/docs/cd/B10501_01/server.920/a96530/migcompa.htm#1010868
|title=Ada Support in Version 8
Line 28 ⟶ 73:
|accessdate=2008-07-14
}}</ref> SQL*Module is a module language that offers a different programming method from embedded SQL. SQL*Module supports the Ada83 language standard for Ada.
 
; C/C++ : [[Pro*C]] became Pro*C/C++ with Oracle8. Pro*C/C++ is currently supported as of Oracle Database 11''g''.
; C/C++
; COBOL : Pro*COBOL is currently supported as of Oracle Database 11''g''.
: [[Pro*C]] became Pro*C/C++ with Oracle8. Pro*C/C++ is currently supported as of Oracle Database 11''g''.
; Fortran : Pro*FORTRAN is no longer updated as of Oracle8 but Oracle will continue to issue patch releases as bugs are reported and corrected.<ref name="langalts"/>
 
; Pascal : Pro*Pascal was not released with Oracle8.<ref name="langalts"/>
; COBOL
; PL/I : Pro*PL/I was not released with Oracle8. The ''Pro*PL/I Supplement to the Oracle Precompilers Guide'', however, continues to make appearances in the Oracle Documentation Library (current as of release 11''g'').<ref name="langalts">{{cite web
: Pro*COBOL is currently supported as of Oracle Database 11''g''.
 
; Fortran
: Pro*FORTRAN is no longer updated as of Oracle8 but Oracle will continue to issue patch releases as bugs are reported and corrected.<ref name="langalts"/>
 
; [[Pascal (programming language)|Pascal]]
: Pro*Pascal was not released with Oracle8.<ref name="langalts"/>
 
; [[PL/I]]
: Pro*PL/I was not released with Oracle8. The ''Pro*PL/I Supplement to the Oracle Precompilers Guide'', however, continued to make appearances in the Oracle Documentation Library until release 11''g''. As of release 12c, the Pro*PL/I has been removed from the Oracle Documentation Library.<ref name="langalts">{{cite web
|url=http://download.oracle.com/docs/cd/A64702_01/doc/server.805/a58232/ch01.htm#505
|title=Language Alternatives
Line 42 ⟶ 97:
=== PostgreSQL ===
; C/C++
: [[ECPG]] is part of [[PostgreSQL]] since version 6.3.
; COBOL
: [http://www.cobol-it.com Cobol-IT] is now distributing a COBOL precompiler for PostgreSQL{{cn|date=March 2016}}
: Micro Focus provides support via their OpenESQL preprocessor{{cn|date=March 2016}}
 
=== AltibaseSAP Sybase ===
SAP Sybase ASE 15.7 supports embedded SQL for C and COBOL as part of the Software Developer Kit [[Sybase]].<ref>{{cite web
; C/C++
|url=http://www.sybase.com/products/allproductsa-z/softwaredeveloperkit/embeddedsql
: SESC is an embedded SQL precompiler provided by [[Altibase]] Corp. for its DBMS server.
|title=EmbeddedSQL
 
|work=SAP Sybase Products
=== Data Access Corporation ===
|publisher=SAP Sybase
With DataFlex 3.2 and Visual DataFlex you can pass SQL statements via one of the Data Access CLI connectivity kits to Microsoft SQL Server, IBM DB2 or any ODBC supporting database. The results can be retrieved and processed.
|accessdate=2012-09-05
 
|archive-date=2009-10-23
=== Microsoft SQL Server ===
|archive-url=https://web.archive.org/web/20091023214433/http://www.sybase.com/products/allproductsa-z/softwaredeveloperkit/embeddedsql
; COBOL
|url-status=dead
: [http://www.cobol-it.com Cobol-IT] is distributing a Embedded SQL precompiler for COBOL.
 
=== MySQL ===
; COBOL
: [http://www.cobol-it.com Cobol-IT] is distributing a Embedded SQL precompiler for COBOL.
 
== Systems that do not support Embedded SQL ==
=== Microsoft SQL Server ===
Embedded SQL for C has been deprecated as of [[Microsoft SQL Server]] 2008 although earlier versions of the product support it.<ref>{{cite web
|url=http://msdn.microsoft.com/en-us/library/ms143729.aspx
|title=Deprecated Database Engine Features in SQL Server 2008
|work=SQL Server 2008 Books Online (March 2009)
|publisher=[[Microsoft]]
|accessdate=2009-04-10
}}</ref>
 
SAP Sybase SQL Anywhere supports embedded SQL for C and C++ as part of the SQL Anywhere database management system [[SQL Anywhere]].<ref>{{cite web
=== MySQL ===
|url=http://www54.sap.com/pc/tech/database/software/sybase-sql-anywhere/index.html
[[MySQL]] does not support Embedded SQL.<ref>{{cite web
|title=SAP Sybase SQL Anywhere
|url=http://dev.mysql.com/tech-resources/articles/precompiler-for-embedded-sql.html
|work=SAP Sybase Products
|title=An Open Pre-Compiler for Embedded SQL
|publisher=SAP Sybase
|work=MySQL DevZone Articles
|accessdate=2013-05-02
|publisher=[[Mysql]]
|archive-url=https://web.archive.org/web/20130501030013/http://www54.sap.com/pc/tech/database/software/sybase-sql-anywhere/index.html
|accessdate=2009-04-10
|archive-date=2013-05-01
|url-status=dead
}}</ref>
 
SAP Sybase IQ supports embedded SQL for C and C++ as part of the Sybase IQ database management system [[Sybase IQ]].<ref>{{cite web
=== Sybase ===
|url=http://www54.sap.com/pc/tech/database/software/sybase-iq-big-data-management/index.html
Embedded SQL support has been discontinued by [[Sybase]].<ref>{{cite web
|title=SAP Sybase IQ
|url=http://www.sybase.com/products/archivedproducts/embeddedsql
|work=SAP Sybase Products
|title=EmbeddedSQL
|publisher=SAP Sybase
|work=Sybase Products
|accessdate=2013-05-02
|publisher=Sybase
|archive-url=https://web.archive.org/web/20130504025213/http://www54.sap.com/pc/tech/database/software/sybase-iq-big-data-management/index.html
|accessdate=2009-04-10
|archive-date=2013-05-04
|url-status=dead
}}</ref>
 
== Embedded SQL through ___domain-specific languages ==
* [[Language Integrated Query|LINQ-to-SQL]] embeds a SQL-like language into [[List of CLI languages|.NET languages]].
* [[Java Persistence API|JPA]] embeds a SQL-like language through [http://docs.oracle.com/javaee/6/tutorial/doc/gjrij.html Criteria API] into [[Java (programming language)|Java]].
* [[Java Object Oriented Querying|jOOQ]] embeds a SQL-like language into [[Java (programming language)|Java]].
 
== See also ==
* [[Language binding]]
* [[Module SQL]]
* [[PL/SQL]]
* [[Pro*C/C++]]
* [[SQL/OLB]]
* [[SQL PL]]
* [[Transact-SQL]]
 
== References ==
Line 99 ⟶ 156:
* [http://infolab.stanford.edu/%7Eullman/fcdb/oracle/or-proc.html Introduction to Pro*C Embedded SQL]
* [http://www.oreillynet.com/pub/a/databases/2006/12/07/embedded-sql-with-pro-c.html Embedded SQL with Pro*C]
* [httphttps://tahitidocs.oracle.com/plscd/db92B10501_01/db92appdev.show_toc?partno=920/a58231/ch2.htm SQL*Module for Ada Programmer's Guide, Release 8.0]
* [httphttps://www.postgresql.org/docs/8.3/interactivecurrent/ecpg.html ECPG, PostgreSQL 8.3 Documentation]
* [https://www.ibm.com/support/knowledgecenter/SSGU8G_14.1.0/com.ibm.esqlc.doc/esqlc.html ESQL/C, Informix Documentation]'
* [https://developer.mimer.com/article/embedded-sql-in-c/ Embedded SQL in C, Mimer SQL Developer]
 
[[Category:SQL]]
Line 106 ⟶ 165:
[[Category:Query languages]]
[[Category:Data modeling languages]]
[[Category:Database APIs]]
 
[[deCategory:Embedded SQL data access]]
[[ja:埋め込みSQL]]
[[ru:Embedded SQL]]
[[fi:Embedded SQL]]
[[zh:嵌入式SQL]]