MySQL Types to Java Types for ResultSet.getObject()
2013-10-23 23:52
441 查看
MySQL Type Name | Return value ofGetColumnClassName | Returned as Java Class |
---|---|---|
BIT(1)(new in MySQL-5.0) | BIT | java.lang.Boolean |
BIT( > 1)(new in MySQL-5.0) | BIT | byte[] |
TINYINT | TINYINT | java.lang.Booleanif the configuration property tinyInt1isBitis set to true(the default) and the storage size is 1, or java.lang.Integerif not. |
BOOL, BOOLEAN | TINYINT | See TINYINT, above as these are aliases for TINYINT(1), currently. |
SMALLINT[(M)] [UNSIGNED] | SMALLINT [UNSIGNED] | java.lang.Integer(regardless if UNSIGNEDor not) |
MEDIUMINT[(M)] [UNSIGNED] | MEDIUMINT [UNSIGNED] | java.lang.Integer,if UNSIGNED java.lang.Long(C/J 3.1 and earlier), or java.lang.Integerfor C/J 5.0 and later |
INT,INTEGER[(M)] [UNSIGNED] | INTEGER [UNSIGNED] | java.lang.Integer, if UNSIGNED java.lang.Long |
BIGINT[(M)] [UNSIGNED] | BIGINT [UNSIGNED] | java.lang.Long, if UNSIGNED java.math.BigInteger |
FLOAT[(M,D)] | FLOAT | java.lang.Float |
DOUBLE[(M,B)] | DOUBLE | java.lang.Double |
DECIMAL[(M[,D])] | DECIMAL | java.math.BigDecimal |
DATE | DATE | java.sql.Date |
DATETIME | DATETIME | java.sql.Timestamp |
TIMESTAMP[(M)] | TIMESTAMP | java.sql.Timestamp |
TIME | TIME | java.sql.Time |
YEAR[(2|4)] | YEAR | If yearIsDateTypeconfiguration property is set to false, then the returned object type is java.sql.Short. If set to true(the default), then the returned object is of type java.sql.Datewith the date set to January 1st, at midnight. |
CHAR(M) | CHAR | java.lang.String(unless the character set for the column is BINARY, then byte[]is returned. |
VARCHAR(M) [BINARY] | VARCHAR | java.lang.String(unless the character set for the column is BINARY, then byte[]is returned. |
BINARY(M) | BINARY | byte[] |
VARBINARY(M) | VARBINARY | byte[] |
TINYBLOB | TINYBLOB | byte[] |
TINYTEXT | VARCHAR | java.lang.String |
BLOB | BLOB | byte[] |
TEXT | VARCHAR | java.lang.String |
MEDIUMBLOB | MEDIUMBLOB | byte[] |
MEDIUMTEXT | VARCHAR | java.lang.String |
LONGBLOB | LONGBLOB | byte[] |
LONGTEXT | VARCHAR | java.lang.String |
ENUM('value1','value2',...) | CHAR | java.lang.String |
SET('value1','value2',...) | CHAR | java.lang.String |
相关文章推荐
- Got an exception - java.lang.RuntimeException: Unable to get class information for @throws tag 'XXXException'.
- Unable to find a value for "字段名" in object of class java.lang.String using operator "."
- how to get the default maximum heap size for Sun's JVM from Java SE 6 or 7
- java MySQL server version for the right syntax to use near
- JDBC Types Mapped to Java Object Types
- Unable to get VFS File object for filename 'file:///': Unknown scheme "sftp" in URI "{1}".
- checkstyle问题:解决Got an exception - java.lang.RuntimeException: Unable to get class information for ***Exception
- Memcached ++++ exception thrown while trying to get object from cache for key
- how to get Class of primitive datatypes array . Class.forName(int[]) throws exception
- Unable to find a value for "dwmc" in object of class "java.lang.String" using operator "." (null
- Ubuntu install mysql-connector-java for java to connect MySQL database
- Jdbc-Type mismatch: cannot convert from java.sql.ResultSet to com.mysql.jdbc.ResultSet
- java.sql.SQLException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for
- FAQ(52):java.sql.SQLException: Column Index out of range, 0 > 13. at com.mysql.jdbc.ResultSet.getInt
- JAVA: WARN for JSONObject.toJSONString将空指针格式化成字符串“null”
- Java中反射机制和Class.forName、实例对象.class(属性)、实例对象getClass()的区别
- 提示:ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'mysql'
- failed to get the task for process 23828
- JSONObject 解析从网络获取的json数据时,java.lang.String cannot be converted to JSONObject解决办法(编码 UTF-8)
- process launch failed: failed to get the task for process 28107