JDBC---The correspondence between Java and data types in a database

Source: Internet
Author: User

Underlying data type

Java type SQL type
int or Java.lang.Integer INTEGER
Long or Java.lang.Long BIGINT
Short or Java.lang.Short SMALLINT
float or java.lang.Float FLOAT
Double or java.lang.Double DOUBLE
Java.math.BigDecimal NUMERIC
Java.lang.String VARCHAR
byte or Java.lang.Byte TINYINT
Boolean or Java.lang.Boolean Bit (a value of 0 or 1)

Date and Time type

Java type

ANSI SQL Type

Java.util.Date or Java.sql.Date DATE
Java.util.Date or Java.sql.Time Time
Java.util.Date or Java.sql.Timestamp TIMESTAMP
Java.util.Calendar DATE

JDK-related types

Java Type SQL Type
Java.lang.Class VARCHAR
Java.util.Locale VARCHAR
Java.util.TimeZone VARCHAR
Java.util.Currency VARCHAR

JDBC---The correspondence between Java and data types in a database

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.