What you Didn’t Know About JDBC Batch

In our previous blog post "10 Common Mistakes Java Developers Make When Writing SQL", we have made a point about batching being important when inserting large data sets. In most databases and with most JDBC drivers, you can get a significant performance improvement when running a single prepared statement in batch mode as such: PreparedStatement … Continue reading What you Didn’t Know About JDBC Batch

Advanced Java Trickery for Typesafe Query DSLs

When browsing Hacker News, I recently stumbled upon Benji Weber's most interesting attempt at creating typesafe database interaction with Java 8. Benji created a typesafe query DSL somewhat similar to jOOQ with the important difference that it uses Java 8 method references to introspect POJOs and deduce query elements from it. This is best explained by … Continue reading Advanced Java Trickery for Typesafe Query DSLs

Lesser-Known SQL Features: DEFAULT VALUES

A lesser-known SQL feature is the DEFAULT keyword, which can be used in INSERT and UPDATE statements. Consider the following table, created using standard SQL syntax: CREATE TABLE timestamps ( id INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 1), t TIMESTAMP DEFAULT CURRENT_TIMESTAMP, CONSTRAINT pk_values PRIMARY KEY (id) ) Now, in order to generate a … Continue reading Lesser-Known SQL Features: DEFAULT VALUES

The SQL Language’s Most Missing Feature

SQL is also awesome in many ways. We can write out the most complex truths and facts and have the database tell us the answer in no time. But the SQL language is arguably the most beautiful programming language out there. It has so many caveats that people like me get ridiculously rich selling consulting services … Continue reading The SQL Language’s Most Missing Feature

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 standardPart of the SQL standardQuite easy to understandQuite a powerful extension to JDBC So why did it die … Continue reading Why Did SQLJ Die?

Why Your Boring Data Will Outlast Your Sexy New Technology

So you're playing around with all those sexy new technologies, enjoying yourself, getting inspiration from state-of-the-art closure / lambda / monads and other concepts-du-jour... Now that I have your attention provoking a little anger / smirk / indifference, let's think about the following. I've recently revisited a great article by Ken Downs written in 2010. … Continue reading Why Your Boring Data Will Outlast Your Sexy New Technology

Typesafe’s Slick is Not About SQL

We have stumbled upon an interesting thread on the Typesafe SLICK user group where Slick was compared to jOOQ. In that thread, Christopher Vogt has made a couple of interesting statements. But let us have a look at the broader context, first. Unifying Stuff Ever since the proclamation of UDDI or RUP, we may think that … Continue reading Typesafe’s Slick is Not About SQL

MySQL Bad Idea #666

MySQL... We've blogged about MySQL before. Many times. We've shown bad ideas implemented in MySQL here: MySQL Bad Idea #384MySQL Bad Idea #573 But this beats everything. Check out this Stack Overflow question. It reads: "Why Oracle does not support 'group by 1,2,3'?". At first, I thought this user might have been confused because SQL … Continue reading MySQL Bad Idea #666

Ecto a Slick Query DSL for the Elixir Language

Elixir? What on earth is Elixir? It is a programming language that somewhat reminds me of Ruby. Here is some example Elixir code: defmodule Hello do IO.puts "Defining the function world" def world do IO.puts "Hello World" end IO.puts "Function world defined" end And it has a Stack Overflow community with around 50 tagged questions … Continue reading Ecto a Slick Query DSL for the Elixir Language

MyBatis’ Alternative Transaction Management

On the jOOQ user group, we're often being asked how to perform transaction management with jOOQ. And we have an easy answer ready: You don't do that with jOOQ. You choose your favourite transaction management API, be it: JDBC Spring JEE JTA (e.g. as supported by Weblogic) Bitronix TM Hibernate And the above list is far … Continue reading MyBatis’ Alternative Transaction Management