jOOQ Newsletter September 17, 2013

Subscribe to this newsletter here.

SQL for calculations

SQL can be used for heavy calculations. This doesn’t mean that it has to, of course. Many Java-oriented software architects are reluctant to allow for business logic entering their database. DBA tend to disagree and promote complex logic in database views or stored procedures.

The pros and cons of both sides can be seen in this popular discussion on reddit. Our take on this discussion is a rather pragmatic one, saying: Neither approach is “better”. But not knowing about awesome, often vendor-specific SQL features is a pity. For example, here are two approaches to calculating a running total with Oracle SQL:

What is your experience with SQL for calculations? Reply to this e-mail and tell us your story.

SQL Performance Explained

SQL Performance ExplainedWhen running calculations in the database using SQL, it is always good to know your way around indexing and performance tuning. As jOOQ is a very SQL-centric environment, we would like to promote a very good book about SQL Performance.

SQL databases have become incredibly fast in parsing and executing even very complex SQL statements. But to many SQL developers, writing performing SQL is still a mystery. SQL Performance Explained by Markus Winandcovers 90% of what any SQL developer should know in very simple terms. A must-read for all SQL beginners and pros! Available in English, German, and French.

PostgreSQL 9.3

PostgreSQL 9.3 has been released! This is great news as a wonderful database has just gotten better. Apart from support for materialised views and updatable views, PostgreSQL now also supports the SQL standard LATERAL JOIN, which will soon be supported in jOOQ as well.

More about what’s new in PostgreSQL 9.3 can be seen here.

Google and MariaDB

After RedHat’s alleged switching from MySQL to MariaDB in RHEL, Google now also announces that they will start to migrate away from Oracle’s popular Open Source database. These migrations will further strengthen MariaDB’s position and communities, as large players in the data market will stop contributing to MySQL and contribute to MariaDB instead.

Read more about this migration here.

Plagiarism is Copyright Infringement AND Poor Form

Please repost / reblog / spread the word, should you have been victim of a similar act of plagiarism or copyright infringement!

With my blog getting increasingly popular, I’m more and more facing the problem of plagiarism. Plagiarism is bad for a variety of reasons:

  • It hurts the original author’s SEO, as content starts getting less relevant when duplicated verbatim across the net.
  • It is very poor form and just a plain embarassment to the offender.
  • It will inevitably get back at you. Right, Mr Guttenberg?

Why do people engage in plagiarism? When there is Fair Use? Why do people pretend they have authored something themselves, which they have stolen? Why do people obscure their sources?

I am going to take plagiarism very seriously and not tolerate it. With Google and Google Analytics, it is very easy to detect plagiarism. I’ve recently had an article removed from a popular Indian website, which seems to heavily engage in plagiarism: TechGig.com

ITeye.com is another platform from China, whose members ruthlessly engage in plagiarism as well. Yes, Google also ships with Google Translate. Another great tool to detect plagiarism. Beware, offenders! I will be going after you. And if you make money with my content, I am more than happy to collect some of that, or have your domain challenged with your registrar! All top-level domains are eventually protected by the DMCA, as the ICANN is an American-dominated organisation. You don’t want to risk such action just because a couple of geeks on your platform cannot control themselves! And if your platform itself is the offender, then be sure that you will close down very soon!

Here’s a letter I wrote to CSDN.net (registrar) and ITeye.com. I am licensing this letter as public domain, for you to reuse against your own offenders. Take any parts you may need.

To whom it may concern,

I have found your contact through a whois lookup, as ITeye themselves fail to respond to my recent enquiry. I am continuing to notice that a couple of ITeye bloggers and curators copy and translate articles off my blog http://blog.jooq.org, which is a promotional blog for my database product jOOQ.

In particular, these posts here:

… were in fact copied from my popular blog post here:

… which was syndicated with my express permission to DZone and JCG:

Plagiarism and copyright infringement is a non-trivial offence in many countries, including Switzerland from where I am operating. I urge ITeye to

  • give full author attribution to myself for all blog posts that ITeye writers copy and / or translate verbatim
  • have such authors link to my *original* blog post (not to syndications thereof)
  • have such authors keep promotional links in place
  • or to remove such blog posts immediately

I am taking this infringement very seriously, as the above displays go beyond what is known as “Fair Use”. I am sure ITeye understand that it is of utmost priority for a platform such as ITeye to comply with such laws. I am also sure that CSDN, the registrant will be able to execute the appropriate actions, should ITeye fail to comply, in case of which I will need to act on behalf of the American DMCA.

Please do not engage in plagiarism. Please, critically review your writers’ works and actively block all suspicious content.

Sincerely,

Lukas Eder

The Announcer Badge on Stack Overflow

It just struck me like lightning. I just realised one (surely not the only) very important reason, why Stack Overflow always winds up at least once in the top 10 search results on Google for virtually any programming-related search. The Announcer Badge. When you share a link to a Stack Overflow question or answer using the “share” button, you get a personalised link including your own user ID. If that link generates 25 clicks from distinct IPs, you’ll get an Announcer Badge as a reward for linking to Stack Overflow. This badge has been awarded more than 25k times. Note, there’s also the Booster Badge (awarded around 800 times) and Publicist Badge (awarded around 300 times).

Stack Overflow uses a lot of techniques following the Gamification principle. But this particular badge is really clever. Trick your users into creating highly relevant links from arbitrary websites towards Stack Overflow helping to add relevancy to the platform and to its various questions / answers.

Well done, Stack Overflow!

jOOQ Tutorial by Ikai Lan

A friend of mine recently found a nice tutorial about jOOQ on the web:

http://ikaisays.com/2011/11/01/getting-started-with-jooq-a-tutorial

This was written by Ikai Lan, a Google App Engine developer. See also my previous blog post about a jOOQ integration example with Google Cloud SQL:

https://lukaseder.wordpress.com/2011/10/22/jooq-and-google-cloud-sql-example/

jOOQ and Google Cloud SQL Example

This is all too simple. Here’s how you can create an easy jOOQ / Google Cloud SQL integration example:

  1. Sign up with Google App Engine
  2. Sign up with Google Cloud SQL
  3. Create a Google App Engine project (preferably with Eclipse)
  4. Add jOOQ to your project
  5. Add your generated schema to your project
  6. Done

Google Cloud SQL is actually a MySQL database, which you can also install locally on your machine for development purposes. For your jOOQ integration, this means that you will set up the code generation and execution just as if you were using a plain MySQL database. Simple, huh?

See a simple example in action, here:
http://jooq-test.appspot.com/jooq-test

Check out the source code here (libs not included):
https://github.com/lukaseder/jOOQ/blob/master/jOOQ-google-cloud-sql/src/org/jooq/test/JOOQTest.java

And some instructions about Google Cloud SQL:
https://code.google.com/apis/sql/docs/developers_guide_java.html

Google Cloud SQL, the next step for jOOQ?

“The Cloud” is probably the biggest IT buzzword in 2011. It may as well be as meaningless and as short-lived as its predecessors “web 2.0” and “dotcom”, but clearly, the big companies are aiming for “The Cloud” right now. After Microsoft’s all-out marketing campaign for Windows Azure and its sub-product SQL Azure, there is now a comparable Google offensive on Google Labs:

http://code.google.com/apis/sql/docs/developers_guide_java.html

OK, marketing-wise, the term “offensive” is way over the top: Google Labs products often look quite geeky and by far less professional than those by Microsoft. But the approach is interesting, especially the choice of using MySQL as a SQL platform in the cloud. NoSQL was a response to traditional SQL’s inability to scale horizontally. If you buy a big box for your Oracle database, you’ll add memory and CPU power to make it scale vertically as your application grows. You’ll fine-tune your SQL, preferably with jOOQ ;-), to prevent performance bottlenecks in single queries. You’ll pay expensive DBA’s for the job.

When SQL goes to the cloud, however, horizontal scaling might become more realistic… I’m very curious to see where this goes. Clearly, jOOQ should be one of the first Java database abstraction tools to fully support Google Cloud SQL as well as SQL Azure.