Enum DatabaseName

    • Enum Constant Detail

      • DERBY

        public static final DatabaseName DERBY
        Apache Derby
      • ORACLE

        public static final DatabaseName ORACLE
        Oracle Database
      • SQL_SERVER

        public static final DatabaseName SQL_SERVER
        Microsoft SQL Server
      • AZURE

        public static final DatabaseName AZURE
        Microsoft Azure - needs special handling since the product name provided by JDBC cannot be distinguished from SQL Server.
      • POSTGRES

        public static final DatabaseName POSTGRES
        PostgreSQL
      • CACHE

        @Deprecated(since="14.5.0",
                    forRemoval=true)
        public static final DatabaseName CACHE
        Deprecated, for removal: This API element is subject to removal in a future version.
        Use IRIS instead.
        InterSystems Cache
      • IRIS

        public static final DatabaseName IRIS
        InterSystems IRIS
    • Method Detail

      • values

        public static DatabaseName[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (DatabaseName c : DatabaseName.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static DatabaseName valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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 type has no constant with the specified name
        NullPointerException - if the argument is null
      • getProductName

        public String getProductName()
        Gets (part of) the product name returned by the metadata of the database.
        Returns:
        (Part of) the product name returned by the metadata of the database.
      • getProviderClass

        public String getProviderClass()
        Gets the name of the provider class for the database.
        Returns:
        The name of the provider class for the database.
      • getDatabaseNameForProductName

        @Deprecated
        public static DatabaseName getDatabaseNameForProductName​(String productName)
        Deprecated.
        Use getDatabaseName(Connection) instead to properly detect Azure.
        Finds the database name for the given database product name.
        Parameters:
        productName - The product name of the database as provided by the DatabaseMetaData.
        Returns:
        The database name for the given database product name or null if no database is found for the designated product name.
      • getDatabaseName

        public static DatabaseName getDatabaseName​(Connection con)
                                            throws SQLException
        Detects the database type based on the designated connection.
        Parameters:
        con - The JDBC connection to be examined.
        Returns:
        The detected database name or null if the database is not recognised.
        Throws:
        SQLException - if a database access error occurs