StringBuffer tableString = new StringBuffer("CREATE TABLE mysql_all_types(");
// Column Name MySQL Type Java Type
tableString.append("column_boolean BOOL, "); // boolean
tableString.append("column_byte TINYINT, "); // byte
tableString.append("column_short SMALLINT, " ); // short
tableString.append("column_int INTEGER, " ); // int
tableString.append("column_long BIGINT, " ); // long
tableString.append("column_float FLOAT, " ); // float
tableString.append("column_double DOUBLE PRECISION, "); // double
tableString.append("column_bigdecimal DECIMAL(13,0), " ); // BigDecimal
tableString.append("column_string VARCHAR(254), " ); // String
tableString.append("column_date DATE, " ); // Date
tableString.append("column_time TIME, " ); // Time
tableString.append("column_timestamp TIMESTAMP, " );// Timestamp
tableString.append("column_asciistream1 TINYTEXT, " ); // Clob (< 2^8 bytes)
tableString.append("column_asciistream2 TEXT, " ); // Clob (< 2^16 bytes)
tableString.append("column_asciistream3 MEDIUMTEXT, " ); // Clob (< 2^24 bytes)
tableString.append("column_asciistream4 LONGTEXT, " ); // Clob (< 2^32 bytes)
tableString.append("column_blob1 TINYBLOB, " ); // Blob (< 2^8 bytes)
tableString.append("column_blob2 BLOB, " ); // Blob (< 2^16 bytes)
tableString.append("column_blob3 MEDIUMBLOB, " ); // Blob (< 2^24 bytes)
tableString.append("column_blob4 LONGBLOB)" ); // Blob (< 2^32 bytes)
stmt.executeUpdate(tableString.toString());
|