apache.org > db > ddlutils |
MySQL
MySQL is supported from version 3.23 onwards. Note that the major versions (3, 4, 5) differ in their datatype support. The supported SQL syntax and datatypes can be found in the MySQL Reference Manual.
DdlUtils provides two platforms, one for MySql versions 3 and 4, and one for MySql version 5 and above. The latter implements some aspects of reading back a model from the database differently to address some changes in MySql 5.
Platform identifiers:
- MySQL
- MySQL5
Recognized JDBC drivers:
- com.mysql.jdbc.Driver
- org.gjt.mm.mysql.Driver
Recognized JDBC sub protocol:
- jdbc:mysql
The database supports SQL comments | yes |
The database supports delimited identifiers | yes |
The database's maximum identifier length | 64 |
The database supports default values for LONG types | no |
DdlUtils uses sequences for identity columns | no |
The database supports non-primary key columns as identity columns | no |
The database allows INSERT/UPDATE statements to set values for identity columns | yes |
DdlUtils can read back the auto-generated value of an identity column | yes |
The database supports non-unique indices | yes |
DdlUtils can create a database via JDBC | no |
DdlUtils can drop a database via JDBC | no |
JDBC Type | Database Type | Additional comments |
---|---|---|
ARRAY | LONGBLOB | Will be read back as LONGVARBINARY |
BIGINT | BIGINT | |
BINARY | BINARY | |
BIT | TINYINT(1) | MySQL has no native boolean type |
BLOB | LONGBLOB | Will be read back as LONGVARBINARY |
BOOLEAN | TINYINT(1) | MySQL has no native boolean type Will be read back as BIT |
CHAR | CHAR | |
CLOB | LONGTEXT | Will be read back as LONGVARCHAR |
DATALINK | MEDIUMBLOB | Will be read back as LONGVARBINARY |
DATE | DATE | |
DECIMAL | DECIMAL | |
DISTINCT | LONGBLOB | Will be read back as LONGVARBINARY |
DOUBLE | DOUBLE | |
FLOAT | DOUBLE | Will be read back as DOUBLE |
INTEGER | INTEGER | |
JAVA_OBJECT | LONGBLOB | Will be read back as LONGVARBINARY |
LONGVARBINARY | MEDIUMBLOB | |
LONGVARCHAR | MEDIUMTEXT | |
NULL | MEDIUMBLOB | Will be read back as LONGVARBINARY |
NUMERIC | DECIMAL | Will be read back as DECIMAL |
OTHER | LONGBLOB | Will be read back as LONGVARBINARY |
REAL | FLOAT | MySQL has a REAL datatype that is per default an alias for DOUBLE, though it might be mapped to FLOAT via configuration of the server. Therefore, DdlUtils explicitly uses FLOAT. |
REF | MEDIUMBLOB | Will be read back as LONGVARBINARY |
SMALLINT | SMALLINT | |
STRUCT | LONGBLOB | Will be read back as LONGVARBINARY |
TIME | TIME | |
TIMESTAMP | DATETIME | TIMESTAMP is not a stable MySQL datatype yet, and it does not support a higher precision than DATETIME (year to seconds) as of MySQL 5, DdlUtils maps the JDBC type to DATETIME instead. |
TINYINT | SMALLINT | In MySQL, TINYINT only has a range of -128 to +127. This DdlUtils uses SMALLINT instead. Will be read back as SMALLINT |
VARBINARY | VARBINARY | |
VARCHAR | VARCHAR |