Why Did SQLJ Die?
Every now and then, SQLJ pops up somewhere, mostly in a very dusty/enterprisey or in an academic context.
If you give SQLJ some thought, though, it isn’t such a bad idea. It is:
- An ANSI and ISO standard
- Part of the SQL standard
- Quite easy to understand
- Quite a powerful extension to JDBC
Let’s assume that you have already decided to embed your SQL (as opposed to externalising it through a templating mechanism, hiding it with an ORM, or with stored procedures). Here are a couple of reasons why SQLJ is not an optimal solution for embedding SQL:
While Pro*C worked well for C and C++ in the 90s, Java really took off in the early 2000’s. With Java, there were also an increasing number of powerful IDEs such as Eclipse, NetBeans, JBuilder, and others. Java preprocessors and IDEs have never become friends, though, as parsing one language is hard enough. Parsing (and providing tooling) for two languages is much harder.
In fact, SQLJ made the surrounding Java code type-unsafe as IDEs and compilers couldn’t process .sqlj files before they had been pre-processed.
There was a time when people started thinking that SQL itself was going to be dead. First, they did so with the advent of ORMs, then they did so with the advent of NoSQL. People thought that the DBA is dead. Again.
Well, this has been proven to be wrong a couple of times, but certainly not because of SQLJ.
In the late 2000’s, there had now been typesafe alternatives to SQLJ, such as jOOQ in Java, or LINQ-to.SQL in .NET, which leverage IDE features such as syntax autocompletion. By being internal domain-specific languages / query DSLs, these APIs not only bring typesafety to embedded SQL, but they also allow for dynamic SQL building, which SQLJ doesn’t support.
While embedding SQL into other languages is a useful thing, SQLJ never solved this problem adequately. Hence, R.I.P., SQLJ
That was awesome, right? Share it with your friends!
- 979,156 hits
- RT @DZone: The Inconvenient Truth About Dynamic vs. Static Typing by @lukaseder bit.ly/1wt10OI 1 day ago
- Not only can you easily bind your custom #JSON implementation to #jOOQ 3.5 bindings, but also #XML via #DOM, #SAX, #StAX, #JAXB or #XSLT! 1 day ago
Get Back in Control of Your SQL
Top Posts & Pages
- 10 Common Mistakes Java Developers Make when Writing SQL
- SQL Trick: row_number() is to SELECT what dense_rank() is to SELECT DISTINCT
- 10 Subtle Best Practices when Coding Java
- The 10 Most Popular DB Engines (SQL and NoSQL)
- Does Java 8 Still Need LINQ? Or is it Better than LINQ?
- Do You Really Understand SQL's GROUP BY and HAVING clauses?
- Java 8 Friday: 10 Subtle Mistakes When Using the Streams API
- Really Too Bad that Java 8 Doesn't Have Iterable.stream()
- Java 8 Friday: No More Need for ORMs
- The Inconvenient Truth About Dynamic vs. Static Typing
- A True SQL Gem You Didn’t Know Yet: The EVERY() Aggregate Function December 18, 2014
- jOOQ Tuesdays: Yalım Gerger brings Git to Oracle December 16, 2014
- Really Too Bad that Java 8 Doesn’t Have Iterable.stream() December 15, 2014
- The Inconvenient Truth About Dynamic vs. Static Typing December 11, 2014
- Don’t be “Clever”: The Double Curly Braces Anti Pattern December 8, 2014
- Do You Really Understand SQL’s GROUP BY and HAVING clauses? December 4, 2014
- How to Integrate Commercial Third-Party Artefacts into Your Maven Build December 2, 2014
- jOOQ Newsletter: November 28, 2014 – Black Friday jOOQ Sale – Only Today! November 28, 2014
- Use MySQL’s Strict Mode on all new Projects! November 20, 2014
- jOOQ Tip of the Day: Discover all Primary Keys November 14, 2014