Connect to Aurora (MySQL) from a Java application

Overview

What I want to say in this article is that you can use ** MariaDB Connector / J ** instead of ** MySQL Connector / J ** when connecting to Aurora (MySQL) from a Java application.

What is Connector / J?

You must use the ** JDBC driver ** to connect to MySQL from Java

When connecting to MySQL, use a JDBC driver called ** Connector / J ** Here, the one created by MySQL is called ** MySQL Connector / J **, and the one created by MariaDB derived from MySQL is called ** MariaDB Connector / J **.

Both could be used with Aurora (MySQL), but ...

MariaDB Connector / J should be selected for Aurora (MySQL)

To conclude earlier, ** it supports Aurora failover **, so I chose MariaDB Connector / J.

Apparently, connect to all instances of Writer and Reader, and determine that innodb_read_only is Off = master. After that, it seems to check replica_host_status which is more reliable than the cluster endpoint.

The Official Site has a description of the corresponding version.

Driver Version Java Version
2.X Java 9, Java 8
> 1.6.1 - < 2 Java 9, Java 8, Java 7, Java 6
1.2 - 1.6.1 Java 8, Java 7
1.1 Java 8, java 7, Java 6

I actually tried

For MySQL Connector / J, the connection is 0 screen_capture_11-05.png

In the case of MariaDB Connctor / J, both Writer and Reader are connected. screen_capture_11-05(0).png

Looking for friends

Our company is looking for engineers. We carry out a wide range of business from infrastructure to apps and user support. https://www.nittsu-infosys.com/recruit/2019/index.html

Recommended Posts

Connect to Aurora (MySQL) from a Java application
[Java] Connect to MySQL
Connect from Java to MySQL using Eclipse
Connect from Java to PostgreSQL
Connect to MySQL 8 with Java
I want to connect to Heroku MySQL from a client
Access Teradata from a Java application
To become a VB.net programmer from a Java shop
From Java to Ruby !!
[Java / PostgreSQL] Connect the WEB application to the database
Ssh connect using SSHJ from a Java 6 app
It took a month from application to taking the Oracle Java SE 11 Silver
[Java] I tried to connect using a connection pool with Servlet (tomcat) & MySQL & Java
How to jump from Eclipse Java to a SQL file
To connect from Spring to MySQL on virtual server (unsolved)
[Java] How to erase a specific character from a character string
Migration from Cobol to JAVA
New features from Java7 to Java8
Connect to DB with Java
Rewriting from applet to application
[Android] Connect to MySQL (unfinished)
From Ineffective Java to Effective Java
[Azure] I tried to create a Java application for free ~ Connect with FTP ~ [Beginner]
I tried to modernize a Java EE application with OpenShift.
From studying programming for 2 months to releasing a web application
[Java] How to convert a character string from String type to byte type
How to store a string from ArrayList to String in Java (Personal)
Operation to connect multiple Streams @Java
Preparing to create a Rails application
How to make a Java container
Run a batch file from Java
[Java] How to create a folder
Upgrade from MYSQL5.7 to 8.0 on CentOS 6.7
Java to be involved from today
From Java to VB.NET-Writing Contrast Memo-
Java, interface to start from beginner
Change DB from SQLite to MySQL
The road from JavaScript to Java
[Java] Conversion from array to List
Update MySQL from 5.7 to 8.0 with Docker
How to make a Java array
02. I made an API to connect to MySQL (MyBatis) from Spring Boot
Introduction to Scala from a Java perspective, decompiled and understood (basic)
I want to develop a web application!
How to make a Java calendar Summary
Access MySQL on a Docker container from a local (host OS) Java program
Introduction to Scala from a Java perspective (Class-Tuple edition) to decompile and understand
Convert from java UTC time to JST time
[Introduction to Java] How to write a Java program
A program that calculates factorials from 2 to 100
The story of switching from Amazon RDS for MySQL to Amazon Aurora Serverless
Create a MySQL environment with Docker from 0-> 1
Java beginner tried to make a simple web application using Spring Boot
How to make a Discord bot (Java)
Try running a Kubernetes Job from Java
From installing Eclipse to executing Java (PHP)
Post to Slack from Play Framework 2.8 (Java)
Java: How to send values from Servlet to Servlet
How to print a Java Word document
[Java] Flow from source code to execution
Introduction to monitoring from Java Touching Prometheus