Performance Testing: Samples Isolation

This article is intended to explain the important use case of sharing data across the ThreadGroups in JMeter where most developers/test engineers face these challenges. Let's start with the example use case below:

  1. Create JDBC Requests in a ThreadGroup.
  2. Retrieve the Results.
  3. Share the Results to Another Thread Group
  4. Use the Results to Send the HTTP Calls.

As part of this material:

Asynchronous RDBMS Access With Spring Data R2DBC

Not too long ago, a reactive variant of the JDBC driver was released, known as R2DBC. It allows data to be streamed asynchronously to any endpoints that have subscribed to it. Using a reactive driver like R2DBC together with Spring WebFlux allows you to write a full application that handles the receiving and sending of data asynchronously. In this post, we will focus on the database and on connecting to the database and then finally saving and retrieving data. To do this, we will be using Spring Data. As with all Spring Data modules, it provides us with out-of-the-box configuration, decreasing the amount of boilerplate code that we need to write to get our application setup. On top of that, it provides a layer upon the database driver that makes doing the simple tasks easier and the more difficult tasks a little less painful.

For the content of this post, I am making use of a Postgres database. At the time of writing only Postgres, H2 and Microsoft SQL Server have their own implementations of R2DBC drivers.

Tackling RESOURCE_LOCAL Vs. JTA Under Java EE Umbrella and Payara Server

Learning JPA is a road marked with a lot of questions. Some of the notorious questions include: "What is actually a persistence-unit?," "What is an extended persistence-context?," "Why is wrong to fetch read-only data as entities?," "Why should I care aboutRESOURCE_LOCALorJTA?," and so on and forth. 

This article targets people that are confused by the JPA transaction types,RESOURCE_LOCAL, andJTA. But, let's take it step by step.

How to Specify Named Parameters Using the NamedParameterJdbcTemplate

Overview

Spring JdbcTemplate is a powerful mechanism to connect to the database and execute SQL queries. It internally uses JDBC API but eliminates a lot of problems of JDBC API. It helps to avoid writing boilerplate code for such as creating the connection, statement, closing resultset, connection, etc.. 

With JdbcTemple, we generally do pass the parameter values with "?" (question mark). However, it is going to introduce the SQL injection problem. So, Spring provides another way to insert data by the named parameter. In that way, we use names instead of "?". So it is better to remember the data for the column. This can be done using NamedParameterJdbcTemplate.

Specify Named Parameters Using the NamedParameterJdbcTemplate

In this article, we will cover how to use NamedParameterJdbcTemplate in a Spring boot application connected to a Postgres Database at the backend. We will be inserting, updating, and deleting employees from Postgres DB using NamedParameterJdbcTemplate. Just to keep the design appropriate, I have separated the dao, service, and controller. Service is just a pass-through in this article.

Overview

NamedParameterJdbcTemplate is a template class that allows a basic set of JDBC operations. It has an underlying classic JdbcTemplate, which allows running native SQL queries with '?' placeholders in execution time for prepared statements. NamedParameterJdbcTemplate implements NamedParameterJdbcOperations interface and holds the reference of JdbcTemplate object in JdbcOperations interface.

Connecting to Mariadb with Libreoffice

I am trying to establish a connection between LibreOffice (5.4.6.2) and Mariadb (10.1.29)/mysql. I have researched various resources on the web but am stuck not being able to establish a connection

preliminary steps taken:

  • the file mariadb-java-client-2.4.0.jar is downloaded from https://downloads.mariadb.com/Connectors/java/connector-java-2.3.0/
  • JRE is installed and enabled under LibreOffice Tools > Options > Advanced
  • in that Advanced tab, Class Path is set with mariadb-java-client-2.4.0.jar (I have tried with a path /opt/mariadb-java-client-2.4.0.jar and /home/<my user name>/mariadb-java-client-2.4.0.jar)

Based on web site and youtube tutorials, the next steps are to connect via LibreOffice Base. Using the wizard:

  • Connect to an existing database MySQL is chosen from the dropdown
  • after clicking Next >>
  • Under some video and how-to tutorials, there has been a third option of Connect directly... Is this a further clue that something is not set properly?
  • I choose Connect using JDBC...and click Next >>
  • I provide the database name, the server (have tried localhost and 127.0.0.1) and port number 3306
  • for the MySQL JDBC driver class I change the string to org.mariadb.jdbc.Driver according to https://stackoverflow.com/a/41842833/7932473
  • upon clicking Test Class, a dialog with The JDBC driver could not be loaded appears

I have used JDBC connections before under LO 3.x and MySQL before Mariadb came along. Ultimately, I want to use a connection to my database for further analysis of the data using Calc. Is this still possible? If my memory is not failing me, it is possible to open a Base registered database within LO Calc.