SQLJ
   HOME

TheInfoList



OR:

SQLJ is a working title for efforts to combine
Java Java (; id, Jawa, ; jv, ꦗꦮ; su, ) is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea to the north. With a population of 151.6 million people, Java is the world's mos ...
and SQL. It was a common effort started around 1997 by engineers from IBM, Oracle,
Compaq Compaq Computer Corporation (sometimes abbreviated to CQ prior to a 2007 rebranding) was an American information technology company founded in 1982 that developed, sold, and supported computers and related products and services. Compaq produced ...
,
Informix IBM Informix is a product family within IBM's Information Management division that is centered on several relational database management system (RDBMS) offerings. The Informix products were originally developed by Informix Corporation, whose ...
, Sybase, Cloudscape and Sun Microsystems. It consists of the three parts: 0, 1 and 2. Part 0 describes the embedding of SQL statements into Java programs. SQLJ part 0 is the basis for part 10 of the SQL:1999 standard, aka SQL Object Language Bindings (SQL/OLB). SQLJ parts 1 and 2 describes the converse possibility to use Java classes (routines and types) from SQL statements. Parts 1 and 2 are the basis for part 13 of the SQL standard, SQL Routines and Types Using the Java Programming Language (SQL/JRT). "SQLJ" is commonly used to refer to just SQLJ part 0, usually when it is contrasted with other means of embedding SQL in Java, like
JDBC Java Database Connectivity (JDBC) is an application programming interface (API) for the programming language Java, which defines how a client may access a database. It is a Java-based data access technology used for Java database connectivity. I ...
.


ANSI and ISO standards

* SQLJ part 0:
ANSI The American National Standards Institute (ANSI ) is a private non-profit organization that oversees the development of voluntary consensus standards for products, services, processes, systems, and personnel in the United States. The organi ...
X3.135.10-1998, "Database Language SQL—Part 10: Object Language Bindings (SQL/OLB)" * SQLJ part 1: ANSI NCITS 331.1-1999, "SQLJ—Part 1: SQL Routines Using the Java Programming Language" * SQLJ part 2: ANSI NCITS 331.2-2000, "SQLJ—Part 2: SQL Types Using the Java Programming Language" Part 0 was updated for JDBC 2.0 compatibility and ratified by ISO in 2000. The last two parts were combined when submitted to ISO. Part 2 was substantially rewritten for the ISO submission because the ANSI version was not formal enough for a specification, being closer to the style of a
user manual A user guide, also commonly known as a user manual, is intended to assist users in using a particular product, service or application. It's usually written by a technician, product developer, or a company's customer service staff. Most user guid ...
. The combined version was ratified in 2002. * ISO/IEC 9075-10:2000, ''Information technology—Database languages—SQL—Part 10: Object Language Bindings (SQL/OLB)'' * ISO/IEC 9075-13:2002, ''Information technology—Database languages—SQL—Part 13: SQL Routines and Types Using the Java Programming Language (SQL/JRT)''.


SQLJ part 0

The SQLJ part 0 specification largely originated from Oracle, who also provided the first reference implementation. In the following SQLJ is a synonym for SQLJ part 0. Whereas
JDBC Java Database Connectivity (JDBC) is an application programming interface (API) for the programming language Java, which defines how a client may access a database. It is a Java-based data access technology used for Java database connectivity. I ...
provides an
API An application programming interface (API) is a way for two or more computer programs to communicate with each other. It is a type of software interface, offering a service to other pieces of software. A document or standard that describes how ...
, SQLJ consists of a
language Language is a structured system of communication. The structure of a language is its grammar and the free components are its vocabulary. Languages are the primary means by which humans communicate, and may be conveyed through a variety of ...
extension. Thus programs containing SQLJ must be run through a
preprocessor In computer science, a preprocessor (or precompiler) is a 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 is often used by so ...
(the SQLJ translator) before they can be compiled.


Advantages

Some advantages of SQLJ over JDBC include: * SQLJ commands tend to be shorter than equivalent JDBC programs. * SQL syntax can be checked at compile time. The returned query results can also be checked strictly. * Preprocessor might generate static SQL which performs better than dynamic SQL because query plan is created on program compile time, stored in database and reused at runtime. Static SQL can guarantee access plan stability. IBM DB2 supports static SQL use in SQLJ programs.


Disadvantages

* SQLJ requires a preprocessing step. * Many IDEs do not have SQLJ support. * SQLJ lacks support for most of the common persistence frameworks, such as
Hibernate Hibernation is a state of minimal activity and metabolic depression undergone by some animal species. Hibernation is a seasonal heterothermy characterized by low body-temperature, slow breathing and heart-rate, and low metabolic rate. It most ...
. * Oracle 18c (12.2) has desupported SQLJ in the database.


Examples

The following examples compare SQLJ syntax with JDBC usage.


See also

* Embedded SQL *
Language Integrated Query Language Integrated Query (LINQ, pronounced "link") is a Microsoft .NET Framework component that adds native data querying capabilities to .NET languages, originally released as a major part of .NET Framework 3.5 in 2007. LINQ extends the langua ...
(LINQ)


References


Further reading

* Connie Tsui
Considering SQLJ for Your DB2 V8 Java Applications
IBM
developerworks IBM Developer is a global community of coders, developer advocates, and digital resources that help developers learn, build, and connect. The IBM Developer website (previously known as IBM developerWorks) hosts a wide range of resources, tools, a ...
, 13 Feb 2003 * Owen Cline
Develop your applications using SQLJ
IBM developerworks, 16 Dec 2004 * {{cite book, author=Jason Price, title=Java Programming With Oracle SQLJ, year=2001, publisher=O'Reilly Media, isbn=978-0-596-00087-5, url-access=registration, url=https://archive.org/details/javaprogrammingw00jaso


External links




Oracle SQLJ Developers Guide
Database Connectivity Database APIs SQL data access