Categories
Java

Modify a YAML file with Java

In this tutorial, we explain how to load, modify and finally save some YAML data. We use the SnakeYAML library to achieve this. YAML is a data-serialization language, that allows engineers to share data as readable text files easily. YAML is a JSON superset and has a very light human-friendly syntax. The YAML data format […]

Categories
AWS Bash Linux SQL

Connect MySQL client with private AWS RDS database, from EC2 instance

How to use the MySQL client command line interface with a private AWS RDS MySQL database. Let’s suppose we already have an EC2 instance, with an app that communicates with the database. For instance, the EC2 instance could be part of an Elastic Beanstalk environment (please see here how to setup a private AWS RDS […]

Categories
AWS Bash Linux

SSH to AWS EC2 instance in 2 minutes

How to SSH to an AWS EC2 instance in 2 minutes. We automate most of the process using a bash script, jq and the AWS CLI. 1) Open SSH traffic to the EC2 instance Log into the AWS console and go to the EC2 instances section. Then click on blue Instance ID link of the […]

Categories
AWS SQL

Connect to AWS RDS MySQL from Elastic Beanstalk

In this article, we explain how to connect to a decoupled AWS RDS MySQL database from an AWS Elastic Beanstalk Docker environment. We will add the RDS security group to the Elastic Beanstalk environment. 1) Create the AWS RDS database Log into the AWS console, got to the RDS section, and click on the orange […]

Categories
AWS

AWS certificate manager: create a SSL certificate for a GoDaddy domain

How to create a SSL certificate for a GoDaddy domain, using AWS certificate manager. The process is pretty simple: 1) Create a random SSL certificate with AWS certificate manager which is a Certificate Authority (CA) 2) Add the CNAME DNS verification values given by AWS certificate manager to your domain in GoDaddy 3) Wait for […]

Categories
Java

Java Spring Boot app with JSP, API and static file endpoints in 5 minutes

We explain how to build a Java Spring Boot application with JSP, API and static file endpoints. Then we run the application locally and test the endpoints with cURL, to check that they respond correctly. All that in less than 5 minutes. 1) The JSP controller Let’s say we have a JSP file hello.jsp in […]

Categories
Java SQL

Debug Java HikariCP Pool for JDBC SQL with Logback

In this article, we will explain how to use and debug HikariCP Pool for JDBC SQL with Logback. The goal is to be able to monitor how many connections are opened / closed by the connection pool. We will do a multi-thread load test of SQL requests on the pool, and see how it reacts. […]

Categories
Java SQL

JDBC Java transaction rollback demo with batch inserts

In this tutorial, we will see how JDBC Java transactions rollbacks are useful, with a real world example and a full Java demo. We will look at the particular case of batch inserts. 1) Batch inserts without rollback Let’s use the following SQL table: Starting from a JDBC connection object called conn: , the batch […]

Categories
Java SQL

Java JDBC batch inserts and performance test with PostgreSQL

In this tutorial, we will see how to batch SQL insert queries, using Java JDBC. Then, we will do a performance test to compare batched inserts VS non-batched inserts. 1) The SQL table We will use the following table: 2) Batch inserts Starting from a JDBC connection object called conn: simply do: We use the […]

Categories
Java

Download an image directly with Selenium in Java

In this quick tutorial, we will explain how to download an image directly with Selenium in Java. The advantage of this method, instead of using a classic HTTP client like CURL, is that the website will behave exactly the same way as if you were browsing it with a classic browser like Chrome. 1) Setup […]