db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Db-derby Wiki] Update of "Migration Tips" by Harrus
Date Tue, 29 Nov 2005 21:48:41 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Db-derby Wiki" for change notification.

The following page has been changed by Harrus:
http://wiki.apache.org/db-derby/Migration_Tips

New page:
= Migration Tips =
Migrating other database to Derby and vice versa.

== Overview of column types ==

=== HSQL ===

||<-3> '''Numerical'''||
||INTEGER|INT||as Java type|| int | java.lang.Integer||
||DOUBLE [PRECISION] | FLOAT||as Java type||double |  java.lang.Double||
||DECIMAL||No limit||java.math.BigDecimal||
||NUMERIC||No limit||java.math.BigDecimal||
||BOOLEAN | BIT||as Java type|| boolean | java.lang.Boolean ||
||TINYINT||as Java type||byte | java.lang.Byte||
||SMALLINT||as Java type||short | java.lang.Short  ||
||BIGINT||as Java type||long | java.lang.Long||
||REAL||as Java type||double | java.lang.Double[1]||

||<-3> '''Strings''' ||
||VARCHAR  || as Integer.MAXVALUE  || java.lang.String||
||VARCHAR_IGNORECASE || as Integer.MAXVALUE|| java.lang.String ||
||CHAR || CHARACTER as Integer.MAXVALUE||   java.lang.String||
||LONGVARCHAR || as Integer.MAXVALUE|| java.lang.String  ||

||<-3> '''Date and Time''' ||
||DATE || as Java type|| java.sql.Date||
||TIME || as Java type || java.sql.Time  ||
||TIMESTAMP | DATETIME || as Java type || java.sql.Timestamp ||

||<-3> '''Binary data''' ||
||BINARY || as Integer.MAXVALUE  || byte[]||
||VARBINARY  || as Integer.MAXVALUE  || byte[] ||
||LONGVARBINARY  || as Integer.MAXVALUE  || byte[] ||
||OTHER | OBJECT || as Integer.MAXVALUE  || java.lang.Object||


=== Derby ===

||<-4> '''Numerical''' ||
||Column type || Bytes || Range || Java Type ||
||SMALLINT    || 2 || -32768 java.lang.Short.MIN_VALUE - [[BR]]32767 java.lang.Short.MAX_VALUE||java.lang.Short||
||INTEGER     || 4 || -2147483648 java.lang.Integer.MIN_VALUE -[[BR]]2147483647 java.lang.Integer.MAX_VALUE
||java.lang.Integer ||
||BIGINT      || 8 || -9223372036854775808 java.lang.Long.MIN_VALUE -[[BR]]9223372036854775807
java.lang.Long.MAX_VALUE ||java.lang.Long||
||REAL        || 4 || Smallest REAL value: -3.402E+38[[BR]]Largest REAL value: 3.402E+38[[BR]]Smallest
positive REAL value: 1.175E-37[[BR]]Largest negative REAL value: -1.175E-37 ||java.lang.Float
||
||DOUBLE / DOUBLE PRECISION|| 8 || || ||
||FLOAT (an alias for DOUBLE PRECISION or REAL )|| || || ||
||DECIMAL (storage based on precision) || || || java.math.BigDecimal ||
||NUMERIC (an alias for DECIMAL )|| || || java.math.BigDecimal ||

||<-3> '''Strings''' ||
||Column type || Max. size || Java Type ||
||CHAR || 2147483647 java.lang.Integer.MAX_VALUE || java.lang.String ||
||VARCHAR || 32672 ||java.lang.String ||
||LONG VARCHAR || 32700 ||java.lang.String ||
||CLOB || 2147483647 java.lang.Integer.MAX_VALUE || java.sql.Clob ||

||<-2> '''Date and Time''' ||
||Column type || Java Type ||
||DATE || java.sql.Date ||
||TIME || java.sql.Time ||
||TIMESTAMP || java.sql.Timestamp ||


||<-3> '''Binary data''' ||
||Column type || Max. size || Java Type ||
||BLOB || 2147483647 java.lang.Integer.MAX_VALUE ||java.sql.Blob||
||CHAR FOR BIT DATA || 254 || java.lang.String ||
||VARCHAR FOR BIT DATA|| 32672 || java.lang.String ||
||LONG VARCHAR FOR BIT DATA|| 32700 || java.lang.String ||


=== MySQL ===

||<-4>'''Numerical''' ||
||Column type || Bytes || From || To ||
||TINYINT || 1 || -128 || 127 ||
||SMALLINT || 2 ||-32768 || 32767  ||
||MEDIUMINT || 3 || -8388608 || 8388607  ||
||INT || 4 || -2147483648 || 2147483647  ||
||BIGINT || 8 || -9223372036854775808 || 9223372036854775807||

||<-3> '''Strings''' ||
||Type ||  Max.size || Bytes ||
||CHAR || 2^8-1 || 255 ||
||VARCHAR || 2^8-1 || 255 ||
||TINYTEXT ||  2^8-1 || 255 ||
||TEXT ||  2^16-1 (64K-1) || 65535 ||
||MEDIUMTEXT ||  2^24-1 (16M-1) || 16777215  ||


||<-2> '''Date and Time''' ||
|| Column type || ``Zero'' value  ||
|| DATETIME || '0000-00-00 00:00:00' ||
|| DATE || '0000-00-00' ||
|| TIMESTAMP ||   00000000000000 (length depends on display size) ||
|| TIME || '00:00:00' ||
|| YEAR || 0000 ||

|| Column type || Display format  ||
|| TIMESTAMP(14) || YYYYMMDDHHMMSS  ||
|| TIMESTAMP(12) || YYMMDDHHMMSS  ||
|| TIMESTAMP(10)||  YYMMDDHHMM  ||
|| TIMESTAMP(8)  || YYYYMMDD  ||
|| TIMESTAMP(6) ||  YYMMDD  ||
|| TIMESTAMP(4) ||  YYMM  ||
|| TIMESTAMP(2) ||  YY||


||<-3> '''Binary data''' ||
|| TINYBLOB || 2^8-1 || 255 ||
|| BLOB || 2^16-1 (64K-1) || 65535 ||
|| MEDIUMBLOB || 2^24-1 (16M-1) || 16777215 ||
|| LONGBLOB || 2^32-1 (4G-1) || 4294967295 ||


Mime
View raw message