Description: In Derby, the java.sql.Types are mapped to SQL data types
Keywords: java.sql.Types, mapped to SQL types, SQL types, mapped to java.sql.Types, JDBC types, for JDBC and SQL types, data types, JDBC types to SQL types, LONGVARBINARY, LONGVARCHAR, FLOAT data type

# Mapping of java.sql.Types to SQL types

In Derby, the java.sql.Types are mapped to SQL data types

The following table shows the mapping of java.sql.Types to SQL types.

Table 1. Mapping of java.sql.Types to SQL Types
java.sql.Types | SQL Types
--- | ---
BIGINT | BIGINT
BINARY | CHAR FOR BIT DATA
BIT1 | CHAR FOR BIT DATA
BLOB | BLOB (JDBC 2.0 and up)
CHAR | CHAR
CLOB | CLOB (JDBC 2.0 and up)
DATE | DATE
DECIMAL | DECIMAL
DOUBLE | DOUBLE PRECISION
FLOAT | DOUBLE PRECISION2
INTEGER | INTEGER
LONGVARBINARY | LONG VARCHAR FOR BIT DATA
LONGVARCHAR | LONG VARCHAR
NULL | Not a data type; always a value of a particular type
NUMERIC | DECIMAL
REAL | REAL
SMALLINT | SMALLINT
SQLXML3 | XML
TIME | TIME
TIMESTAMP | TIMESTAMP
VARBINARY | VARCHAR FOR BIT DATA
VARCHAR | VARCHAR

Notes:

1. BIT is only valid in JDBC 2.0 and earlier environments.
2. Values can be passed in using the FLOAT type code; however, these are stored as DOUBLE PRECISION values, and so always have the type code DOUBLE when retrieved.
3. SQLXML is only valid in JDBC 4.0 and later environments. SQLXML corresponds to the SQL type XML in Derby. However, Derby does not recognize the java.sql.Types.SQLXML data type and does not support any JDBC-side operations for the XML data type. Support for XML and the related operators is implemented only at the SQL layer. See XML data types for more.

- Mapping of java.sql.Blob and java.sql.Clob interfaces

Parent topic: JDBC reference
Related concepts
Core JDBC java.sql classes, interfaces, and methods
Related reference
java.sql.Driver interface
java.sql.DriverManager.getConnection method
java.sql.Connection interface
java.sql.DatabaseMetaData interface
java.sql.Statement interface
java.sql.CallableStatement interface
java.sql.SQLException class
java.sql.PreparedStatement interface
java.sql.ResultSet interface
java.sql.ResultSetMetaData interface
java.sql.SQLWarning class
java.sql.SQLXML interface
JDBC 2.0 features
java.sql.BatchUpdateException class
JDBC Package for Connected Device Configuration/Foundation Profile (JSR169)
JDBC 3.0 features
JDBC 4.0-only features
JDBC escape syntax