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!
- 811,020 hits
- Wow, the transformation of jOOQ Open Source to dual-licensed happened a bit over a year ago! buff.ly/1wDaHIw http://t.co/c0avJiDQ5F 22 minutes ago
- The #jOOQ Java/SQL conference tour of 2014 is over. We'll be there for you again in 2015, so far with @JavaLandConf: buff.ly/1wCYEea 3 hours ago
Get Back in Control of Your SQL
Top Posts & Pages
- SQL Trick: row_number() is to SELECT what dense_rank() is to SELECT DISTINCT
- 10 Subtle Best Practices when Coding Java
- 10 Common Mistakes Java Developers Make when Writing SQL
- 10 More Common Mistakes Java Developers Make when Writing SQL
- The 10 Most Popular DB Engines (SQL and NoSQL)
- Does Java 8 Still Need LINQ? Or is it Better than LINQ?
- Java 8 Friday: 10 Subtle Mistakes When Using the Streams API
- Easy Mocking of Your Database
- Using SQL Injection Vulnerabilities to Dump Your Database
- Java 8 Friday Goodies: Map Enhancements
- Let’s Stream a Map in Java 8 with jOOλ October 23, 2014
- Stop Claiming that you’re Using a Schemaless Database October 20, 2014
- The dreaded DefaultAbstractHelperImpl October 17, 2014
- Don’t Miss out on Writing Java 8 SQL One-Liners with jOOλ or jOOQ October 2, 2014
- The Caveats of Dual-Licensing September 30, 2014
- Using Your RDBMS for Messaging is Totally OK September 26, 2014
- Asynchronous SQL Execution with jOOQ and Java 8’s CompletableFuture September 23, 2014
- Top 10 Most Popular Articles on the jOOQ Blog September 22, 2014
- How Nashorn Impacts API Evolution on a New Level September 19, 2014
- This Just In!! Updated Silly Keyword Metrics September 17, 2014