Re: Column Type for mysql float
MySQL supports the floating point numeric types FLOAT, REAL and DOUBLE [PRECISION] but, contrarily to the SQL standard, by default MySQL treats REAL as a synonym for DOUBLE PRECISION (https://dev.mysql.com/doc/refman/8.0/en/numeric-types.html).
Knowing this, Connector/J maps the MySQL types REAL and DOUBLE PRECISION to Java `double` and FLOAT to `float`, but, according to the types mapping table in JDBC specification (http://download.oracle.com/otndocs/jcp/jdbc-4_2-mrel2-spec/index.html) the Java type `double` corresponds to the SQL/JDBC type DOUBLE or FLOAT, and `float` to REAL.
So, this is why your MySQL FLOAT columns get mapped to java.sql.Types.REAL and the DOUBLE/REAL columns get mapped to java.sql.Types.DOUBLE. Other than that, Connector/J internally treats java.sql.Types.FLOAT just as java.sql.Types.DOUBLE.
So, this is not a bug.
IHTH
Subject
Written By
Posted
Re: Column Type for mysql float
July 09, 2018 12:50PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.