All publications

Journal · 2015

A Type-safe Embedding of SQL into Java Using the Extensible Compiler Framework J%

Vassilios Karakoidas, Dimitris Mitropoulos, Panos Louridas, Diomidis Spinellis

The journal account of J%'s SQL support: how an extensible compiler framework checks the syntax and the types of SQL embedded in Java at compile time, instead of leaving both to the database driver at run time.

Published in
Computer Languages, Systems & Structures, 2015
Citations
15 on Google Scholar, read 5 September 2026 — 12 of 30 by count
Cite as
KMLS15

The idea

Embedding SQL in Java through JDBC means passing the query as a string. The Java compiler cannot see into it, so a syntax error, a misspelled column or a type mismatch between a Java variable and the column it is bound to all survive compilation and surface at run time — and only on the code path that happens to run the query. J% moves that checking to compile time: the SQL keeps its own syntax, and the compiler validates it against the schema and checks the Java values that cross into it.

Contributions

  • A type-safe embedding of SQL in Java, syntax- and semantics-checked when the program is compiled.
  • An extensible compiler framework behind it, so SQL is one module rather than a special case welded into the language.

Where it sits

It is the journal-length treatment of the system introduced in the 2009 PCI paper and developed in the thesis. The compiler is J%, its SQL support is documented at the SQL module, and the applications it was evaluated against are J% Ports — five real programs converted query by query.

Written from the published abstract; the full text is behind the DOI above (Elsevier) and is not hosted here. The description of what the system does is corroborated by the PCI 2009 paper and the thesis, both of which this site hosts.