How to Fetch Oracle 12c Implicit Cursors with JDBC and jOOQ

Earlier this week, I've blogged about how to execute SQL batches with JDBC and jOOQ. This was useful for the MySQL, SQL Server, and Sybase users among you. Today, we'll discuss a slightly more difficult task, how to fetch Oracle 12c implicit cursors - which are essentially the same thing. What's an implicit cursor? Oracle … Continue reading How to Fetch Oracle 12c Implicit Cursors with JDBC and jOOQ

How to Execute SQL Batches With JDBC and jOOQ

Some databases (in particular MySQL and T-SQL databases like SQL Server and Sybase) support a very nice feature: They allow for running a "batch" of statements in a single statement. For instance, in SQL Server, you can do something like this: -- Statement #1 DECLARE @table AS TABLE (id INT); -- Statement #2 SELECT * … Continue reading How to Execute SQL Batches With JDBC and jOOQ

How to Prevent JDBC Resource Leaks with JDBC and with jOOQ

In a recent consulting gig, I was analysing a client's connection pool issue in a productive system, where during some peak loads, all the Java processes involving database interactions just started queueing up until nothing really worked anymore. No exceptions, though, and when the peak load was gone in the evening, everything returned back to … Continue reading How to Prevent JDBC Resource Leaks with JDBC and with jOOQ

Using Stored Procedures With JPA, JDBC… Meh, Just Use jOOQ

The current edition of the Java magazine has an article about Big Data Best Practices for JDBC and JPA by Josh Juneau: http://www.javamagazine.mozaicreader.com/MayJune2016 The article shows how to use a stored procedure with JDBC (notice how resources aren't closed, unfortunately. This is commonly forgotten, even in Java Magazine articles) // Using JDBC to call upon … Continue reading Using Stored Procedures With JPA, JDBC… Meh, Just Use jOOQ

It is all about the JDBC Basics

We're very happy to announce a guest post by Marco Behler, who has been blogging about jOOQ in the past. Marco started out in programming (reverse-engineering, actually) and now mainly programmes on the JVM in his day-to-day work. He also always had a sweet tooth for strategy and marketing. Marco Behler GmbH is the result … Continue reading It is all about the JDBC Basics

What’s Even Harder Than Dates and Timezones? Dates and Timezones in SQL / JDBC!

(Notice, this post has been written a while ago. jOOQ now supports JSR 310 data types) There was an interesting discussion recently on the jOOQ mailing list about jOOQ's current lack of out-of-the-box support for TIMESTAMP WITH TIME ZONE data types. No one said that date, time and timezones are easy! There's an amusing piece … Continue reading What’s Even Harder Than Dates and Timezones? Dates and Timezones in SQL / JDBC!

Let’s Review How to Insert Clob or Blob via JDBC

LOBs are a PITA in all databases, as well as in JDBC. Handling them correctly takes a couple of lines of code, and you can be sure that you'll get it wrong eventually. Because you have to think of a couple of things: Foremost, LOBs are heavy resources that need special lifecycle management. Once you've … Continue reading Let’s Review How to Insert Clob or Blob via JDBC

How to FlatMap a JDBC ResultSet with Java 8?

You're not into the functional mood yet? Then the title might not resonate with you - but the article will! Trust me. Essentially, we want this: +------+------+------+ | col1 | col2 | col3 | +------+------+------+ | A | B | C | row 1 | D | E | F | row 2 | G … Continue reading How to FlatMap a JDBC ResultSet with Java 8?

Hack up a Simple JDBC ResultSet Cache Using jOOQ’s MockDataProvider

Some queries shouldn't hit the database all the time. When you query for master data (such as system settings, languages, translations, etc.), for instance, you may want to avoid sending the same silly query (and the results) over the wire all the time. For example: SELECT * FROM languages Most databases maintain buffer caches to … Continue reading Hack up a Simple JDBC ResultSet Cache Using jOOQ’s MockDataProvider

How to Integrate Commercial Third-Party Artefacts into Your Maven Build

According to a recent survey by ZeroTurnaround's RebelLabs, Maven is still the leading Java build platform. The current market share distribution, according to RebelLabs is: Maven with 64% Ant + Ivy with 16.5% Gradle with 11% Yet, at the same time, Maven is often criticised for being a bit obscure and intrusive. Compared to runner-ups … Continue reading How to Integrate Commercial Third-Party Artefacts into Your Maven Build