FOR UPDATE simulation in SQL Server and CUBRID

Pessimistic locking is useful every now and then when you explicitly want to lock a given set of rows for a subsequent UPDATE, or for database-based inter-process synchronisation and locking. Normally, you would use the SQL Standard FOR UPDATE clause, which is supported in most databases. A SQL standard example -- This statement will produce … Continue reading FOR UPDATE simulation in SQL Server and CUBRID

jDBI: A simple convenience layer on top of JDBC

I'm always looking out for similar tools like jOOQ, or at least tools that work in the same domain - the domain of database access abstraction. jDBI looks lovely. It provides simple solutions for what JDBC is lacking in general. Here are a couple of features (taken from the intro): Fluent API JDBC is quite … Continue reading jDBI: A simple convenience layer on top of JDBC

JDBC batch operations with jOOQ

So this was requested again, by another jOOQ user - support for an ancient JDBC feature - java.sql.Statement.addBatch(); With JDBC, you can easily execute several statements at once using the addBatch() method. Essentially, there are two modes in JDBC Execute several queries without bind values Execute one query several times with bind values With code, … Continue reading JDBC batch operations with jOOQ

Use jOOQ to transform java.sql.ResultSet

jOOQ has many uses. The fact that it provides a thin layer of additional abstraction over JDBC can be interesting enough for some users wanting to operate on their own java.sql.ResultSet objects. Let's say, you prefer using JDBC directly, for query execution, rather than letting jOOQ execute queries for you: PreparedStatement stmt = connection.prepareStatement(sql); ResultSet … Continue reading Use jOOQ to transform java.sql.ResultSet

What are procedures and functions after all?

Many RDBMS support the concept of "routines", usually calling them procedures and/or functions. These concepts have been around in programming languages for a while, also outside of databases. Famous languages distinguishing procedures from functions are: Ada BASIC Pascal etc... The general distinction between (stored) procedures and (stored) functions can be summarised like this: Procedures: Are … Continue reading What are procedures and functions after all?

Stored procedures returning multiple cursors

When adding support for Sybase ASE to jOOQ, I came across a peculiar procedure that can be used instead of the dictionary tables, to query for schema meta information (see also my previous post about database schema navigation). With Sybase ASE, you can call a procedure (or pragma?) called sp_help, which will return a cursor … Continue reading Stored procedures returning multiple cursors

Suggestions for the Java, SQL and jOOQ Blog

This blog is picking up momentum and thus, relevance. With jOOQ, I have come a long way, working with Java, JDBC, and SQL. I have solved many problems that are worth discussion, and I know quite a few things about various RDBMS, and how they compare with each other. Some examples: Database Schema Navigation RDBMS … Continue reading Suggestions for the Java, SQL and jOOQ Blog