Home » Tag Archives: Databases

Tag Archives: Databases

Database testing with TestContainers

java-interview-questions-answers

If you have ever written code that tests database interactions, such as data access objects, you very possibly have run up against one of the most perennial annoyances in testing: In order to accurately test these interactions, a database is required. For the sake of this article, let’s consider an application that will be using PostgreSQL as part of its ...

Read More »

Tuning PostgreSQL with pgbench

When it comes to performance tuning an environment, often the first place to start is with the database. The reason for this is that most applications rely very heavily on a database of some sort. Unfortunately, databases can be one of the most complex areas to tune. The reason I say that is because tuning a database service properly often ...

Read More »

Work with Parallel Database Streams using Custom Thread Pools

java-interview-questions-answers

Parallel Database Streams In my previous post, I wrote about processing database content in parallel using parallel streams and Speedment. Parallel streams can, under many circumstances, be significantly faster than the usual sequential database streams.             Speedment is an open-source Stream ORM Java Toolkit and Runtime Java tool that wraps an existing database and its tables ...

Read More »

Using Named Database Locks

In a beginner’s guide to concurrency, I mentioned advisory locks. These are not the usual table locks – they are table-agnostic, database-specific way to obtain a named lock from your application. Basically, you use your database instance for centralized application-level locking. What could it be used for? If you want to have serial operations, this is a rather simple way ...

Read More »

How To: Insert and Read From a Database using Json

In this article we will create a plugin for Speedment that generates serialization and deserialization logic using Gson to make it super easy to map between database entities and JSON strings. This will help to showcase the extendability of the Speedment code generation while at the same time explore some of the cool features of the Gson library. Speedment is ...

Read More »

AutoCommit in PostgreSQL’s psql

One potential surprise for someone familiar with Oracle database‘s SQL*Plus when being introduced to PostgreSQL database‘s psql may be psql‘s default enabling of autocommit. This post provides an overview of psql’s handling of autocommit and some related nuances. By default, Oracle’s SQL*Plus command-line tool does not automatically commit DML statements and the operator must explicitly commit these statements as part ...

Read More »

SPOOLing Queries with Results in psql

SQL*Plus, the Oracle database‘s command-line tool, provides the SPOOL command to “store query results in a file.” The next screen snapshot shows SPOOL used in SQL*Plus to spool the listing of user tables to a file called C:\pdf\output.txt.                 Both the executed query and the results of the query have been spooled to ...

Read More »

SQL for Application Developers

“SQL? Isn’t that just something my ORM tools use?” Often application developers can and should remain at least one level removed from SQL. JPA and the Entity Framework each provide more abstract (and OO-friendly) query languages, and it’s often unnecessary to write any queries at all. If you ever diagnose production support issues, though, being proficient with SQL can greatly ...

Read More »

Agile Databases

Any project following an Agile methodology will usually find itself releasing to production at least 15 – 20 times per year. Even if only half of these releases involve database changes, that’s 10 changes to production databases so you need a good lean process to ensure you get a good paper trail but at the same time you don’t want ...

Read More »