dbTalk Databases Forums  

MySQL Data Truncation error???

comp.databases.mysql comp.databases.mysql


Discuss MySQL Data Truncation error??? in the comp.databases.mysql forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
nino9stars@yahoo.com
 
Posts: n/a

Default MySQL Data Truncation error??? - 01-09-2007 , 01:52 AM






Hello,

Hoping to get some help on something that just makes no sense to me...
Here's hoping someone can help!

I have table setup with a data type as such:
max_dollars double(4,2)

I have a piece of Java code that takes a form entry and submits it to
the database. The insert command looks like this:
db_insert = "insert into BIG_MONEY (max_dollars) values
("+request.getParameter("maxdollars"))";
stmt.executeUpdate(db_insert);

The problem is that when I type in: 140 in the textbox, MySQL throws an
error that looks like this:
SQLException Data truncation: Out of range value adjusted for column
'max_dollars' at row 1

What gives??? I did some looking on the groups and found something that
said to try adding the following to the URL:
?jdbcCompliantTruncation=false

That eliminated the error, but now it just rounds off any number
greater than 100 to 99.99... Any ideas??? This is driving me mad...

Let me know if I left anything else out that might help... Oh, I'm
using MySQL version 5.0.27 and MySQL Java connector 5.04

Thank in advance...
Nino Skilj


Reply With Quote
  #2  
Old   
Jerry Stuckle
 
Posts: n/a

Default Re: MySQL Data Truncation error??? - 01-09-2007 , 06:58 AM






nino9stars (AT) yahoo (DOT) com wrote:
Quote:
Hello,

Hoping to get some help on something that just makes no sense to me...
Here's hoping someone can help!

I have table setup with a data type as such:
max_dollars double(4,2)

I have a piece of Java code that takes a form entry and submits it to
the database. The insert command looks like this:
db_insert = "insert into BIG_MONEY (max_dollars) values
("+request.getParameter("maxdollars"))";
stmt.executeUpdate(db_insert);

The problem is that when I type in: 140 in the textbox, MySQL throws an
error that looks like this:
SQLException Data truncation: Out of range value adjusted for column
'max_dollars' at row 1

What gives??? I did some looking on the groups and found something that
said to try adding the following to the URL:
?jdbcCompliantTruncation=false

That eliminated the error, but now it just rounds off any number
greater than 100 to 99.99... Any ideas??? This is driving me mad...

Let me know if I left anything else out that might help... Oh, I'm
using MySQL version 5.0.27 and MySQL Java connector 5.04

Thank in advance...
Nino Skilj

Well, you defined the field to take a maximum of 99.99. What do you
expect MySQL to do?

If you want to put 140 in there, you need to leave room for three digits
to the left of the decimal point.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex (AT) attglobal (DOT) net
==================


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.