It's not a secret anymore!
The moose likes JDBC and Relational Databases and the fly likes Mapping to REAL = float Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Mapping to REAL = float" Watch "Mapping to REAL = float" New topic

Mapping to REAL = float

Nick Widelec
Ranch Hand

Joined: Feb 28, 2013
Posts: 226

In mysql when I do: describe table; I see in the field I previously declared as REAL the following description: float (4,2) unsigned

First of all it says (4,2) and when I try to put from java more than 2 digits like 100.3 it does not pass. maximum is 2 digits to the right of the decimal separator. so maximum I can set as a REAL 99.something.. However the description appearing from the command: DESCRIBE table; in mysql says clearly float (4,2) unsigned.

I noticed also unsigned and indeed I cannot put anything negative.. only positive numbers.. which contradicts the meaning of float in the java world.

I am wondering if it's only mysql which behaves in this way or all the databases? Thanks in advance.

I agree. Here's the link:
subject: Mapping to REAL = float
It's not a secret anymore!