diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/DataSourceHealthIndicator.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/DataSourceHealthIndicator.java index ddc6692530..6c45a08266 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/DataSourceHealthIndicator.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/DataSourceHealthIndicator.java @@ -207,6 +207,14 @@ public class DataSourceHealthIndicator extends AbstractHealthIndicator }, + AS400("DB2 UDB for AS/400", "SELECT 1 FROM SYSIBM.SYSDUMMY1") { + @Override + protected boolean matchesProduct(String product) { + return super.matchesProduct(product) + || product.toLowerCase().contains("as/400"); + } + }, + INFORMIX("Informix Dynamic Server", "select count(*) from systables"), FIREBIRD("Firebird", "SELECT 1 FROM RDB$DATABASE") { diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/DataSourceHealthIndicatorTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/DataSourceHealthIndicatorTests.java index 39af41d647..94ac816e31 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/DataSourceHealthIndicatorTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/DataSourceHealthIndicatorTests.java @@ -116,6 +116,8 @@ public class DataSourceHealthIndicatorTests { assertThat(Product.forProduct("Apache Derby"), equalTo(Product.DERBY)); assertThat(Product.forProduct("DB2"), equalTo(Product.DB2)); assertThat(Product.forProduct("DB2/LINUXX8664"), equalTo(Product.DB2)); + assertThat(Product.forProduct("DB2 UDB for AS/400"), equalTo(Product.AS400)); + assertThat(Product.forProduct("DB3 XDB fur AS/400"), equalTo(Product.AS400)); assertThat(Product.forProduct("Informix Dynamic Server"), equalTo(Product.INFORMIX)); assertThat(Product.forProduct("Firebird 2.5.WI"), equalTo(Product.FIREBIRD)); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DatabaseDriver.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DatabaseDriver.java index a5baa919b1..daacc3a2e2 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DatabaseDriver.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DatabaseDriver.java @@ -93,7 +93,12 @@ enum DatabaseDriver { /** * DB2 Server. */ - DB2("com.ibm.db2.jcc.DB2Driver", "com.ibm.db2.jcc.DB2XADataSource"); + DB2("com.ibm.db2.jcc.DB2Driver", "com.ibm.db2.jcc.DB2XADataSource"), + + /** + * DB2 AS400 Server. + */ + AS400("com.ibm.as400.access.AS400JDBCDriver", "com.ibm.as400.access.AS400JDBCXADataSource"); private final String driverClassName;