HOME

TheInfoList



OR:

Embedded SQL is a method of combining the
computing Computing is any goal-oriented activity requiring, benefiting from, or creating computer, computing machinery. It includes the study and experimentation of algorithmic processes, and the development of both computer hardware, hardware and softw ...
power of a
programming language A programming language is a system of notation for writing computer programs. Programming languages are described in terms of their Syntax (programming languages), syntax (form) and semantics (computer science), semantics (meaning), usually def ...
and the
database In computing, a database is an organized collection of data or a type of data store based on the use of a database management system (DBMS), the software that interacts with end users, applications, and the database itself to capture and a ...
manipulation capabilities of
SQL Structured Query Language (SQL) (pronounced ''S-Q-L''; or alternatively as "sequel") is a domain-specific language used to manage data, especially in a relational database management system (RDBMS). It is particularly useful in handling s ...
. Embedded SQL statements are SQL statements written inline with the program
source code In computing, source code, or simply code or source, is a plain text computer program written in a programming language. A programmer writes the human readable source code to control the behavior of a computer. Since a computer, at base, only ...
, of the host language. The embedded SQL statements are parsed by an embedded SQL
preprocessor In computer science, a preprocessor (or precompiler) is a Computer program, program that processes its input data to produce output that is used as input in another program. The output is said to be a preprocessed form of the input data, which i ...
and replaced by host-language calls to a code
library A library is a collection of Book, books, and possibly other Document, materials and Media (communication), media, that is accessible for use by its members and members of allied institutions. Libraries provide physical (hard copies) or electron ...
. The output from the preprocessor is then compiled by the host
compiler In computing, a compiler is a computer program that Translator (computing), translates computer code written in one programming language (the ''source'' language) into another language (the ''target'' language). The name "compiler" is primaril ...
. This allows programmers to embed SQL statements in programs written in any number of languages such as C/C++,
COBOL COBOL (; an acronym for "common business-oriented language") is a compiled English-like computer programming language designed for business use. It is an imperative, procedural, and, since 2002, object-oriented language. COBOL is primarily ...
and Fortran. This differs from SQL-derived programming languages that don't go through discrete preprocessors, such as
PL/SQL PL/SQL (Procedural Language for SQL) is Oracle Corporation's procedural extension for SQL and the Oracle relational database. PL/SQL is available in Oracle Database (since version 6 - stored PL/SQL procedures/functions/packages/triggers sinc ...
and T-SQL. The SQL standards committee defined the embedded SQL standard in two steps: a formalism called Module Language was defined, then the embedded SQL standard was derived from Module Language. 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. Host language C and embedded SQL, for example, is called Pro*C in
Oracle An oracle is a person or thing considered to provide insight, wise counsel or prophetic predictions, most notably including precognition of the future, inspired by deities. If done through occultic means, it is a form of divination. Descript ...
and
Sybase Sybase, Inc. was an enterprise software and services company. The company produced software relating to relational databases, with facilities located in California and Massachusetts. Sybase was acquired by SAP in 2010; SAP ceased using the Syba ...
database management systems, ESQL/C in
Informix Informix is a product family within IBM's Information Management division that is centered on several relational database management system (RDBMS) and multi-model database offerings. The Informix products were originally developed by Inform ...
, and ECPG in the
PostgreSQL PostgreSQL ( ) also known as Postgres, is a free and open-source software, free and open-source relational database management system (RDBMS) emphasizing extensibility and SQL compliance. PostgreSQL features transaction processing, transactions ...
database management 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.


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.


IBM Informix

IBM Informix version 14.10 for Linux, Unix, and Windows supports embedded SQL for C. }


Microsoft SQL Server

; C/C++ : Embedded SQL for C has been deprecated as of
Microsoft SQL Server Microsoft SQL Server is a proprietary relational database management system developed by Microsoft using Structured Query Language (SQL, often pronounced "sequel"). As a database server, it is a software product with the primary function of ...
2008 although earlier versions of the product support it.


Mimer SQL

Mimer SQL for Linux,
macOS macOS, previously OS X and originally Mac OS X, is a Unix, Unix-based operating system developed and marketed by Apple Inc., Apple since 2001. It is the current operating system for Apple's Mac (computer), Mac computers. With ...
,
OpenVMS OpenVMS, often referred to as just VMS, is a multi-user, multiprocessing and virtual memory-based operating system. It is designed to support time-sharing, batch processing, transaction processing and workstation applications. Customers using Op ...
and Windows support embedded SQL. ; 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 : Pro*Ada was officially desupported by
Oracle An oracle is a person or thing considered to provide insight, wise counsel or prophetic predictions, most notably including precognition of the future, inspired by deities. If done through occultic means, it is a form of divination. Descript ...
in version 7.3. Starting with Oracle8, Pro*Ada was replaced by SQL*Module but appears to have not been updated since. 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''. ; COBOL : 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. ; Pascal : Pro*Pascal was not released with Oracle8. ;
PL/I PL/I (Programming Language One, pronounced and sometimes written PL/1) is a procedural, imperative computer programming language initially developed by IBM. It is designed for scientific, engineering, business and system programming. It has b ...
: 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.


PostgreSQL

; C/C++ : ECPG is part of
PostgreSQL PostgreSQL ( ) also known as Postgres, is a free and open-source software, free and open-source relational database management system (RDBMS) emphasizing extensibility and SQL compliance. PostgreSQL features transaction processing, transactions ...
since version 6.3. ; COBOL : Cobol-IT is now distributing a COBOL precompiler for PostgreSQL : Micro Focus provides support via their OpenESQL preprocessor


SAP Sybase

SAP Sybase ASE 15.7 supports embedded SQL for C and COBOL as part of the Software Developer Kit
Sybase Sybase, Inc. was an enterprise software and services company. The company produced software relating to relational databases, with facilities located in California and Massachusetts. Sybase was acquired by SAP in 2010; SAP ceased using the Syba ...
. SAP Sybase SQL Anywhere supports embedded SQL for C and C++ as part of the SQL Anywhere database management system SQL Anywhere. SAP Sybase IQ supports embedded SQL for C and C++ as part of the Sybase IQ database management system Sybase IQ.{{cite web , url=http://www54.sap.com/pc/tech/database/software/sybase-iq-big-data-management/index.html , title=SAP Sybase IQ , work=SAP Sybase Products , publisher=SAP Sybase , accessdate=2013-05-02 , archive-url=https://web.archive.org/web/20130504025213/http://www54.sap.com/pc/tech/database/software/sybase-iq-big-data-management/index.html , archive-date=2013-05-04 , url-status=dead


Embedded SQL through domain-specific languages

* LINQ-to-SQL embeds a SQL-like language into .NET languages. * JPA embeds a SQL-like language throug
Criteria API
into
Java Java is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea (a part of Pacific Ocean) to the north. With a population of 156.9 million people (including Madura) in mid 2024, proje ...
. * jOOQ embeds a SQL-like language into
Java Java is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea (a part of Pacific Ocean) to the north. With a population of 156.9 million people (including Madura) in mid 2024, proje ...
.


See also

*
Language binding In programming and software design, a binding is an application programming interface (API) that provides glue code specifically made to allow a programming language to use a foreign library or operating system service (one that is not native to ...
* Module SQL *
PL/SQL PL/SQL (Procedural Language for SQL) is Oracle Corporation's procedural extension for SQL and the Oracle relational database. PL/SQL is available in Oracle Database (since version 6 - stored PL/SQL procedures/functions/packages/triggers sinc ...
* Pro*C/C++ * SQL/OLB * SQL PL *
Transact-SQL Transact-SQL (T-SQL) is Microsoft's and Sybase's proprietary extension to the SQL (Structured Query Language) used to interact with relational databases. T-SQL expands on the SQL standard to include procedural programming, local variables, vari ...


References


External links


Introduction to Pro*C Embedded SQL









Embedded SQL in C, Mimer SQL Developer
SQL Declarative programming languages Query languages Data modeling languages Database APIs SQL data access