JDBCType (Java SE 26 & JDK 26)
Description: declaration: module: java.sql, package: java.sql, enum: JDBCType
Keywords: java.sql.JDBCType class

# Enum Class JDBCType

java.lang.Object
java.lang.Enum<JDBCType>
java.sql.JDBCType

All Implemented Interfaces:
  `Serializable, Comparable<JDBCType>, Constable, SQLType`

public enum JDBCType extends Enum<JDBCType> implements SQLType

Defines the constants that are used to identify generic SQL types, called JDBC types.

Since:
  1.8
See Also:
  - `SQLType`

- ## Nested Class Summary

  ### Nested classes/interfaces declared in class Enum

  `Enum.EnumDesc<E>`
  Modifier and Type
  Class
  Description
  `static final class`
  `Enum.EnumDesc<E extends Enum<E>>`
  A nominal descriptor for an `enum` constant.

- ## Enum Constant Summary

  Enum Constants
  Enum Constant
  Description
  `ARRAY`
  Identifies the generic SQL type `ARRAY`.
  `BIGINT`
  Identifies the generic SQL type `BIGINT`.
  `BINARY`
  Identifies the generic SQL type `BINARY`.
  `BIT`
  Identifies the generic SQL type `BIT`.
  `BLOB`
  Identifies the generic SQL type `BLOB`.
  `BOOLEAN`
  Identifies the generic SQL type `BOOLEAN`.
  `CHAR`
  Identifies the generic SQL type `CHAR`.
  `CLOB`
  Identifies the generic SQL type `CLOB`.
  `DATALINK`
  Identifies the generic SQL type `DATALINK`.
  `DATE`
  Identifies the generic SQL type `DATE`.
  `DECFLOAT`
  Identifies the generic SQL type `DECFLOAT`.
  `DECIMAL`
  Identifies the generic SQL type `DECIMAL`.
  `DISTINCT`
  Identifies the generic SQL type `DISTINCT`.
  `DOUBLE`
  Identifies the generic SQL type `DOUBLE`.
  `FLOAT`
  Identifies the generic SQL type `FLOAT`.
  `INTEGER`
  Identifies the generic SQL type `INTEGER`.
  `JAVA_OBJECT`
  Indicates that the SQL type is database-specific and gets mapped to a Java object that can be accessed via the methods getObject and setObject.
  `JSON`
  Identifies the generic SQL type `JSON`.
  `LONGNVARCHAR`
  Identifies the generic SQL type `LONGNVARCHAR`.
  `LONGVARBINARY`
  Identifies the generic SQL type `LONGVARBINARY`.
  `LONGVARCHAR`
  Identifies the generic SQL type `LONGVARCHAR`.
  `NCHAR`
  Identifies the generic SQL type `NCHAR`.
  `NCLOB`
  Identifies the generic SQL type `NCLOB`.
  `NULL`
  Identifies the generic SQL value `NULL`.
  `NUMERIC`
  Identifies the generic SQL type `NUMERIC`.
  `NVARCHAR`
  Identifies the generic SQL type `NVARCHAR`.
  `OTHER`
  Indicates that the SQL type is database-specific and gets mapped to a Java object that can be accessed via the methods getObject and setObject.
  `REAL`
  Identifies the generic SQL type `REAL`.
  `REF`
  Identifies the generic SQL type `REF`.
  `REF_CURSOR`
  Identifies the generic SQL type `REF_CURSOR`.
  `ROWID`
  Identifies the SQL type `ROWID`.
  `SMALLINT`
  Identifies the generic SQL type `SMALLINT`.
  `SQLXML`
  Identifies the generic SQL type `SQLXML`.
  `STRUCT`
  Identifies the generic SQL type `STRUCT`.
  `TIME`
  Identifies the generic SQL type `TIME`.
  `TIME_WITH_TIMEZONE`
  Identifies the generic SQL type `TIME_WITH_TIMEZONE`.
  `TIMESTAMP`
  Identifies the generic SQL type `TIMESTAMP`.
  `TIMESTAMP_WITH_TIMEZONE`
  Identifies the generic SQL type `TIMESTAMP_WITH_TIMEZONE`.
  `TINYINT`
  Identifies the generic SQL type `TINYINT`.
  `VARBINARY`
  Identifies the generic SQL type `VARBINARY`.
  `VARCHAR`
  Identifies the generic SQL type `VARCHAR`.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `getName()`
  Returns the `SQLType` name that represents a SQL data type.
  `String`
  `getVendor()`
  Returns the name of the vendor that supports this data type.
  `Integer`
  `getVendorTypeNumber()`
  Returns the vendor specific type number for the data type.
  `static JDBCType`
  `valueOf(int type)`
  Returns the `JDBCType` that corresponds to the specified `Types` value
  `static JDBCType`
  `valueOf(String name)`
  Returns the enum constant of this class with the specified name.
  `static JDBCType[]`
  `values()`
  Returns an array containing the constants of this enum class, in the order they are declared.

  ### Methods declared in class Enum

  `clone, compareTo, describeConstable, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf`
  Modifier and Type
  Method
  Description
  `protected final Object`
  `clone()`
  Throws CloneNotSupportedException.
  `final int`
  `compareTo(JDBCType o)`
  Compares this enum with the specified object for order.
  `final Optional<Enum.EnumDesc<JDBCType>>`
  `describeConstable()`
  Returns an enum descriptor `EnumDesc` for this instance, if one can be constructed, or an empty `Optional` if one cannot be.
  `final boolean`
  `equals(Object other)`
  Returns true if the specified object is equal to this enum constant.
  `protected final void`
  `finalize()`
  Deprecated, for removal: This API element is subject to removal in a future version.
  Finalization has been deprecated for removal.
  `final Class<JDBCType>`
  `getDeclaringClass()`
  Returns the Class object corresponding to this enum constant's enum type.
  `final int`
  `hashCode()`
  Returns a hash code for this enum constant.
  `final String`
  `name()`
  Returns the name of this enum constant, exactly as declared in its enum declaration.
  `final int`
  `ordinal()`
  Returns the ordinal of this enumeration constant (its position in its enum declaration, where the initial constant is assigned an ordinal of zero).
  `String`
  `toString()`
  Returns the name of this enum constant, as contained in the declaration.
  `static <T extends Enum<T>>
  T`
  `valueOf(Class<T> enumClass, String name)`
  Returns the enum constant of the specified enum class with the specified name.

  ### Methods declared in class Object

  `getClass, notify, notifyAll, wait, wait, wait`
  Modifier and Type
  Method
  Description
  `final Class<?>`
  `getClass()`
  Returns the runtime class of this `Object`.
  `final void`
  `notify()`
  Wakes up a single thread that is waiting on this object's monitor.
  `final void`
  `notifyAll()`
  Wakes up all threads that are waiting on this object's monitor.
  `final void`
  `wait()`
  Causes the current thread to wait until it is awakened, typically by being notified or interrupted.
  `final void`
  `wait(long timeoutMillis)`
  Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.
  `final void`
  `wait(long timeoutMillis, int nanos)`
  Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

- ## Enum Constant Details

  - ### BIT

    public static final JDBCType BIT
    Identifies the generic SQL type `BIT`.

  - ### TINYINT

    public static final JDBCType TINYINT
    Identifies the generic SQL type `TINYINT`.

  - ### SMALLINT

    public static final JDBCType SMALLINT
    Identifies the generic SQL type `SMALLINT`.

  - ### INTEGER

    public static final JDBCType INTEGER
    Identifies the generic SQL type `INTEGER`.

  - ### BIGINT

    public static final JDBCType BIGINT
    Identifies the generic SQL type `BIGINT`.

  - ### FLOAT

    public static final JDBCType FLOAT
    Identifies the generic SQL type `FLOAT`.

  - ### REAL

    public static final JDBCType REAL
    Identifies the generic SQL type `REAL`.

  - ### DOUBLE

    public static final JDBCType DOUBLE
    Identifies the generic SQL type `DOUBLE`.

  - ### NUMERIC

    public static final JDBCType NUMERIC
    Identifies the generic SQL type `NUMERIC`.

  - ### DECIMAL

    public static final JDBCType DECIMAL
    Identifies the generic SQL type `DECIMAL`.

  - ### CHAR

    public static final JDBCType CHAR
    Identifies the generic SQL type `CHAR`.

  - ### VARCHAR

    public static final JDBCType VARCHAR
    Identifies the generic SQL type `VARCHAR`.

  - ### LONGVARCHAR

    public static final JDBCType LONGVARCHAR
    Identifies the generic SQL type `LONGVARCHAR`.

  - ### DATE

    public static final JDBCType DATE
    Identifies the generic SQL type `DATE`.

  - ### TIME

    public static final JDBCType TIME
    Identifies the generic SQL type `TIME`.

  - ### TIMESTAMP

    public static final JDBCType TIMESTAMP
    Identifies the generic SQL type `TIMESTAMP`.

  - ### BINARY

    public static final JDBCType BINARY
    Identifies the generic SQL type `BINARY`.

  - ### VARBINARY

    public static final JDBCType VARBINARY
    Identifies the generic SQL type `VARBINARY`.

  - ### LONGVARBINARY

    public static final JDBCType LONGVARBINARY
    Identifies the generic SQL type `LONGVARBINARY`.

  - ### NULL

    public static final JDBCType NULL
    Identifies the generic SQL value `NULL`.

  - ### OTHER

    public static final JDBCType OTHER
    Indicates that the SQL type is database-specific and gets mapped to a Java object that can be accessed via the methods getObject and setObject.

  - ### JAVA_OBJECT

    public static final JDBCType JAVA_OBJECT
    Indicates that the SQL type is database-specific and gets mapped to a Java object that can be accessed via the methods getObject and setObject.

  - ### DISTINCT

    public static final JDBCType DISTINCT
    Identifies the generic SQL type `DISTINCT`.

  - ### STRUCT

    public static final JDBCType STRUCT
    Identifies the generic SQL type `STRUCT`.

  - ### ARRAY

    public static final JDBCType ARRAY
    Identifies the generic SQL type `ARRAY`.

  - ### BLOB

    public static final JDBCType BLOB
    Identifies the generic SQL type `BLOB`.

  - ### CLOB

    public static final JDBCType CLOB
    Identifies the generic SQL type `CLOB`.

  - ### REF

    public static final JDBCType REF
    Identifies the generic SQL type `REF`.

  - ### DATALINK

    public static final JDBCType DATALINK
    Identifies the generic SQL type `DATALINK`.

  - ### BOOLEAN

    public static final JDBCType BOOLEAN
    Identifies the generic SQL type `BOOLEAN`.

  - ### ROWID

    public static final JDBCType ROWID
    Identifies the SQL type `ROWID`.

  - ### NCHAR

    public static final JDBCType NCHAR
    Identifies the generic SQL type `NCHAR`.

  - ### NVARCHAR

    public static final JDBCType NVARCHAR
    Identifies the generic SQL type `NVARCHAR`.

  - ### LONGNVARCHAR

    public static final JDBCType LONGNVARCHAR
    Identifies the generic SQL type `LONGNVARCHAR`.

  - ### NCLOB

    public static final JDBCType NCLOB
    Identifies the generic SQL type `NCLOB`.

  - ### SQLXML

    public static final JDBCType SQLXML
    Identifies the generic SQL type `SQLXML`.

  - ### REF_CURSOR

    public static final JDBCType REF_CURSOR
    Identifies the generic SQL type `REF_CURSOR`.

  - ### TIME_WITH_TIMEZONE

    public static final JDBCType TIME_WITH_TIMEZONE
    Identifies the generic SQL type `TIME_WITH_TIMEZONE`.

  - ### TIMESTAMP_WITH_TIMEZONE

    public static final JDBCType TIMESTAMP_WITH_TIMEZONE
    Identifies the generic SQL type `TIMESTAMP_WITH_TIMEZONE`.

  - ### DECFLOAT

    public static final JDBCType DECFLOAT
    Identifies the generic SQL type `DECFLOAT`.
    Since:
      26

  - ### JSON

    public static final JDBCType JSON
    Identifies the generic SQL type `JSON`.
    Since:
      26

- ## Method Details

  - ### values

    public static JDBCType[] 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 JDBCType 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

  - ### getName

    public String getName()
    Returns the `SQLType` name that represents a SQL data type.
    Specified by:
      `getName` in interface `SQLType`
    Returns:
      The name of this `SQLType`.

  - ### getVendor

    public String getVendor()
    Returns the name of the vendor that supports this data type.
    Specified by:
      `getVendor` in interface `SQLType`
    Returns:
      The name of the vendor for this data type which is java.sql for JDBCType.

  - ### getVendorTypeNumber

    public Integer getVendorTypeNumber()
    Returns the vendor specific type number for the data type.
    Specified by:
      `getVendorTypeNumber` in interface `SQLType`
    Returns:
      An Integer representing the data type. For `JDBCType`, the value will be the same value as in `Types` for the data type.

  - ### valueOf

    public static JDBCType valueOf(int type)
    Returns the `JDBCType` that corresponds to the specified `Types` value
    Parameters:
      `type` - `Types` value
    Returns:
      The `JDBCType` constant
    Throws:
      `IllegalArgumentException` - if this enum type has no constant with the specified `Types` value
    See Also:
      - `Types`