Home
 

Database support in DdlUtils

DdlUtils accesses databases via JDBC, esp. the metadata that JDBC provides, as well as by accessing database specific tables and performin database specific SQL. The details of the latter can be found in the support documentation for the individual databases.

The main source of information about JDBC is the JDBC Specification, currently for JDBC version 3. General information about the JDBC datatypes can also be found in Chapter 9: Mapping SQL and Java Types of the JDBC Technology Guide: Getting Started. Please also note that some JDBC types are only available in recent versions of the Java platform, e.g. the BOOLEAN type is only available since J2SE version 1.4. These will be usable with DdlUtils only if you're running the respective Java version or a newer one.

Here is a short summary of the information about the JDBC data types:

 

JDBC data type Format, Range, Size Comments
ARRAY Represents an array
BIGINT -9223372036854775808 to 9223372036854775807 64 bit signed integer
BINARY 254 bytes
BIT 0, 1
BLOB
BOOLEAN true, false Java 1.4 and above
CHAR 254 (8-bit characters)
CLOB
DATALINK Java 1.4 and above. References a file outside of the database but that is managed by it. Maps to java.net.URL
DATE year, month, day
DECIMAL 15 for precision (total number of digits) and for scale (number of digits after the decimal point)
DISTINCT Represents a distinct value, totally implementation dependent
DOUBLE 15 bits of mantissa (fractional part)
FLOAT 15 bits of mantissa (fractional part)
INTEGER -2147483648 to 2147483647 32 bit signed integer
JAVA_OBJECT Represents an java object, usually a serialized one
LONGVARBINARY 1 GB
LONGVARCHAR 1 GB (8-bit characters)
NULL Is not specified in detail
NUMERIC 15 for precision (total number of digits) and for scale (number of digits after the decimal point)
OTHER Entirely database-specific type
REAL 7 bits of mantissa (fractional part)
REF Represents a reference to an instance of a SQL structured type. Maps to java.sql.Ref.
SMALLINT -32768 to 32767 16 bit signed integer
STRUCT Represents a structured type, usually created via CREATE TYPE. Maps to java.sql.Struct.
TIME hours, minutes, seconds
TIMESTAMP year, month, day, hours, minutes, seconds, nanoseconds
TINYINT -128 to 127 (8 bit signed) or 0 to 254 (8 bit unsigned) 8 bit signed or unsigned integer
VARBINARY 254 bytes
VARCHAR 254 bytes (8-bit characters)