Enum Class DatabaseDriver

java.lang.Object
java.lang.Enum<DatabaseDriver>
org.springframework.boot.jdbc.DatabaseDriver
All Implemented Interfaces:
Serializable, Comparable<DatabaseDriver>, Constable

public enum DatabaseDriver extends Enum<DatabaseDriver>
Enumeration of common database drivers.
Since:
1.4.0
  • Enum Constant Details

    • UNKNOWN

      public static final DatabaseDriver UNKNOWN
      Unknown type.
    • DERBY

      public static final DatabaseDriver DERBY
      Apache Derby.
    • H2

      public static final DatabaseDriver H2
      H2.
    • HSQLDB

      public static final DatabaseDriver HSQLDB
      HyperSQL DataBase.
    • SQLITE

      public static final DatabaseDriver SQLITE
      SQLite.
    • MYSQL

      public static final DatabaseDriver MYSQL
      MySQL.
    • MARIADB

      public static final DatabaseDriver MARIADB
      Maria DB.
    • ORACLE

      public static final DatabaseDriver ORACLE
      Oracle.
    • POSTGRESQL

      public static final DatabaseDriver POSTGRESQL
      Postgres.
    • REDSHIFT

      public static final DatabaseDriver REDSHIFT
      Amazon Redshift.
      Since:
      2.2.0
    • HANA

      public static final DatabaseDriver HANA
      HANA - SAP HANA Database - HDB.
      Since:
      2.1.0
    • JTDS

      public static final DatabaseDriver JTDS
      jTDS. As it can be used for several databases, there isn't a single product name we could rely on.
    • SQLSERVER

      public static final DatabaseDriver SQLSERVER
      SQL Server.
    • FIREBIRD

      public static final DatabaseDriver FIREBIRD
      Firebird.
    • DB2

      public static final DatabaseDriver DB2
      DB2 Server.
    • DB2_AS400

      public static final DatabaseDriver DB2_AS400
      DB2 AS400 Server.
    • TERADATA

      public static final DatabaseDriver TERADATA
      Teradata.
    • INFORMIX

      public static final DatabaseDriver INFORMIX
      Informix.
    • PHOENIX

      public static final DatabaseDriver PHOENIX
      Apache Phoenix.
      Since:
      2.5.0
    • TESTCONTAINERS

      public static final DatabaseDriver TESTCONTAINERS
      Testcontainers.
  • Method Details

    • values

      public static DatabaseDriver[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static DatabaseDriver valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • getId

      public String getId()
      Return the identifier of this driver.
      Returns:
      the identifier
    • getUrlPrefixes

      protected Collection<String> getUrlPrefixes()
      Return the url prefixes of this driver.
      Returns:
      the url prefixes
    • matchProductName

      protected boolean matchProductName(String productName)
    • getDriverClassName

      public String getDriverClassName()
      Return the driver class name.
      Returns:
      the class name or null
    • getXaDataSourceClassName

      public String getXaDataSourceClassName()
      Return the XA driver source class name.
      Returns:
      the class name or null
    • getValidationQuery

      public String getValidationQuery()
      Return the validation query.
      Returns:
      the validation query or null
    • fromJdbcUrl

      public static DatabaseDriver fromJdbcUrl(String url)
      Find a DatabaseDriver for the given URL.
      Parameters:
      url - the JDBC URL
      Returns:
      the database driver or UNKNOWN if not found
    • fromProductName

      public static DatabaseDriver fromProductName(String productName)
      Find a DatabaseDriver for the given product name.
      Parameters:
      productName - product name
      Returns:
      the database driver or UNKNOWN if not found
    • fromDataSource

      @Deprecated(since="2.7.15", forRemoval=true) public static DatabaseDriver fromDataSource(DataSource dataSource)
      Deprecated, for removal: This API element is subject to removal in a future version.
      since 2.7.15 for removal in 3.3.0 with no replacement
      Find a DatabaseDriver for the given DataSource.
      Parameters:
      dataSource - data source to inspect
      Returns:
      the database driver of UNKNOWN if not found
      Since:
      2.6.0