This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Kubernetes in Action and have Marko Luksa on-line!
See this thread for details.
Win a copy of Kubernetes in Action this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

jsp and mysql error  RSS feed

 
Ranch Hand
Posts: 152
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how to insert a decimal value into mysql database.
eg: value like 2.5 to mysql field of datatype float.
but when i try to insert 2.5 from jsp to mysql database it get converted to 2 in the database??
 
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How is your float defined? How many digits do you allow after the decimal place?
 
Marshal
Posts: 56949
174
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you will have to provide more detail. What format have you got the 2.5 in, and what sort of variable to you put it into, before inserting it into the database?
How did you specify the float value?
 
author
Bartender
Posts: 4093
21
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Show us the code. I imagine there's somewhere your converting it to integer.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!