This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JDBC and the fly likes PreparedStatement.setFloat not entering precise values in db Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "PreparedStatement.setFloat not entering precise values in db" Watch "PreparedStatement.setFloat not entering precise values in db" New topic
Author

PreparedStatement.setFloat not entering precise values in db

java dunce
Greenhorn

Joined: Aug 12, 2004
Posts: 1
Hi
I have written a program where I am entering a record in to the
database using a prepared statement. The problem is for float datatypes, the
values being entered into the database are not rounded off. e.g. 1.65 is
being entered as 1.64999999
I am using the Sybase database and the driver is
com.sybase.jdbc2.jdbc.SybDriver.

If I use staement instead of prepared statement, i am getting the correct values.
Regards
Julian Kennedy
Ranch Hand

Joined: Aug 02, 2004
Posts: 823
Can you post the two code fragments you're using?
Make sure you use the UBB CODE tags.

Thanks

Jules
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60732
    
  65

"java dunce",

We're pleased to have you here with us on the Ranch, but there are a few rules that need to be followed, and one is that proper names are required. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Thanks!
bear
Forum Bartender


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: PreparedStatement.setFloat not entering precise values in db
 
Similar Threads
Prepared Statement
Ignoring case in queries.........
SQL Injection
Urgent Java interview question 6+ yrs exp.
Can't read string with quotes around it in my bean method - Please help?????