From ac4525ddf8b280759c0d3ba63d3569dda64a2e3a Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Tue, 5 Feb 2019 16:02:17 +0100 Subject: [PATCH] Detect MariaDB as MySQL (for mariadb-java-client 2.4+ compatibility) Closes gh-22344 --- .../java/org/springframework/jdbc/support/JdbcUtils.java | 5 ++++- .../org/springframework/jdbc/support/sql-error-codes.xml | 6 ++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/support/JdbcUtils.java b/spring-jdbc/src/main/java/org/springframework/jdbc/support/JdbcUtils.java index f3b8f4e030d..a714d975e95 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/support/JdbcUtils.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/support/JdbcUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -418,6 +418,9 @@ public abstract class JdbcUtils { if (source != null && source.startsWith("DB2")) { name = "DB2"; } + else if ("MariaDB".equals(source)) { + name = "MySQL"; + } else if ("Sybase SQL Server".equals(source) || "Adaptive Server Enterprise".equals(source) || "ASE".equals(source) || diff --git a/spring-jdbc/src/main/resources/org/springframework/jdbc/support/sql-error-codes.xml b/spring-jdbc/src/main/resources/org/springframework/jdbc/support/sql-error-codes.xml index 5e3cd6f840d..bec81aab96f 100644 --- a/spring-jdbc/src/main/resources/org/springframework/jdbc/support/sql-error-codes.xml +++ b/spring-jdbc/src/main/resources/org/springframework/jdbc/support/sql-error-codes.xml @@ -186,6 +186,12 @@ + + + MySQL + MariaDB + + 1054,1064,1146