com.mysql.cj.conf

## Enum ConnectionUrl.Type

- java.lang.Object
- - java.lang.Enum<ConnectionUrl.Type>
  - - com.mysql.cj.conf.ConnectionUrl.Type

All Implemented Interfaces:
  Serializable, Comparable<ConnectionUrl.Type>

Enclosing class:
  ConnectionUrl

    public static enum ConnectionUrl.Type
    extends Enum<ConnectionUrl.Type>

The database URL type which is determined by the scheme section of the connection string.

### Enum Constant Summary

Enum Constants
`FAILOVER_CONNECTION`
`FAILOVER_DNS_SRV_CONNECTION`
`LOADBALANCE_CONNECTION`
`LOADBALANCE_DNS_SRV_CONNECTION`
`REPLICATION_CONNECTION`
`REPLICATION_DNS_SRV_CONNECTION`
`SINGLE_CONNECTION`
`XDEVAPI_DNS_SRV_SESSION`
`XDEVAPI_SESSION`

### Field Summary

Fields
`private ConnectionUrl.Type` `alternateDnsSrvType`
`private ConnectionUrl.HostsCardinality` `cardinality`
`private PropertyKey` `dnsSrvPropertyKey`
`private String` `implementingClass`
`private String` `scheme`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`static ConnectionUrl.Type` `fromValue(String scheme, int n)` Returns the `ConnectionUrl.Type` corresponding to the given scheme and number of hosts, if any.
`ConnectionUrl.Type` `getAlternateDnsSrvType()`
`ConnectionUrl.HostsCardinality` `getCardinality()`
`static ConnectionUrl` `getConnectionUrlInstance(ConnectionUrlParser parser, Properties info)` Instantiates a class that implements the right type of connection URLs for the given `ConnectionUrlParser`.
`PropertyKey` `getDnsSrvPropertyKey()`
`String` `getImplementingClass()`
`private ConnectionUrl` `getImplementingInstance(ConnectionUrlParser parser, Properties info)` Instantiates a class that implements this type of connection URLs with the given arguments.
`String` `getScheme()`
`static boolean` `isSupported(String scheme)` Checks if the given scheme corresponds to one of the connection types the driver supports.
`static ConnectionUrl.Type` `valueOf(String name)` Returns the enum constant of this type with the specified name.
`static ConnectionUrl.Type[]` `values()` Returns an array containing the constants of this enum type, in the order they are declared.

### Methods inherited from class java.lang.Enum

`clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf`

### Methods inherited from class java.lang.Object

`getClass, notify, notifyAll, wait, wait, wait`

### Enum Constant Detail

#### FAILOVER_DNS_SRV_CONNECTION

    public static final ConnectionUrl.Type FAILOVER_DNS_SRV_CONNECTION

#### LOADBALANCE_DNS_SRV_CONNECTION

    public static final ConnectionUrl.Type LOADBALANCE_DNS_SRV_CONNECTION

#### REPLICATION_DNS_SRV_CONNECTION

    public static final ConnectionUrl.Type REPLICATION_DNS_SRV_CONNECTION

#### XDEVAPI_DNS_SRV_SESSION

    public static final ConnectionUrl.Type XDEVAPI_DNS_SRV_SESSION

#### SINGLE_CONNECTION

    public static final ConnectionUrl.Type SINGLE_CONNECTION

#### FAILOVER_CONNECTION

    public static final ConnectionUrl.Type FAILOVER_CONNECTION

#### LOADBALANCE_CONNECTION

    public static final ConnectionUrl.Type LOADBALANCE_CONNECTION

#### REPLICATION_CONNECTION

    public static final ConnectionUrl.Type REPLICATION_CONNECTION

#### XDEVAPI_SESSION

    public static final ConnectionUrl.Type XDEVAPI_SESSION

### Field Detail

#### scheme

    private String scheme

#### cardinality

    private ConnectionUrl.HostsCardinality cardinality

#### implementingClass

    private String implementingClass

#### dnsSrvPropertyKey

    private PropertyKey dnsSrvPropertyKey

#### alternateDnsSrvType

    private ConnectionUrl.Type alternateDnsSrvType

### Method Detail

#### values

    public static ConnectionUrl.Type[] 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 (ConnectionUrl.Type c : ConnectionUrl.Type.values())
        System.out.println(c);

Returns:
  an array containing the constants of this enum type, in the order they are declared

#### valueOf

    public static ConnectionUrl.Type 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

#### getScheme

    public String getScheme()

#### getCardinality

    public ConnectionUrl.HostsCardinality getCardinality()

#### getImplementingClass

    public String getImplementingClass()

#### getDnsSrvPropertyKey

    public PropertyKey getDnsSrvPropertyKey()

#### getAlternateDnsSrvType

    public ConnectionUrl.Type getAlternateDnsSrvType()

#### fromValue

    public static ConnectionUrl.Type fromValue(String scheme,
                                               int n)

Returns the `ConnectionUrl.Type` corresponding to the given scheme and number of hosts, if any. Otherwise throws an `UnsupportedConnectionStringException`. Calling this method with the argument n lower than 0 skips the hosts cardinality validation.

Parameters:
  `scheme` - one of supported schemes
  `n` - the number of hosts in the database URL
Returns:
  the `ConnectionUrl.Type` corresponding to the given protocol and number of hosts

#### getConnectionUrlInstance

    public static ConnectionUrl getConnectionUrlInstance(ConnectionUrlParser parser,
                                                         Properties info)

Instantiates a class that implements the right type of connection URLs for the given `ConnectionUrlParser`.

Parameters:
  `parser` - the `ConnectionUrlParser` containing the URL components.
  `info` - a connection properties map to add to the `ConnectionUrl` structure.
Returns:
  an instance of `ConnectionUrl`.

#### isSupported

    public static boolean isSupported(String scheme)

Checks if the given scheme corresponds to one of the connection types the driver supports.

Parameters:
  `scheme` - scheme part from connection string, like "jdbc:mysql:"
Returns:
  true if the given scheme is supported by driver

#### getImplementingInstance

    private ConnectionUrl getImplementingInstance(ConnectionUrlParser parser,
                                                  Properties info)

Instantiates a class that implements this type of connection URLs with the given arguments.

Parameters:
  `parser` - the `ConnectionUrlParser` containing the URL components.
  `info` - a connection properties map to add to the `ConnectionUrl` structure.
Returns:
  an instance of `ConnectionUrl`.

Copyright © 2016, 2026, Oracle and/or its affiliates.