?
Solved

data truncation error / use jdbcCompliantTruncation?

Posted on 2006-10-20
8
Medium Priority
?
827 Views
Last Modified: 2008-01-09
I've got a web app in ColdFusion feeding a MySQL 5 database.  I'm getting inconsistent errors when doing inserts -- inconsistent in that it is not always throwing an error.  When it does throw an error, the error is

Data truncation: Data truncated for column 'COLUMN_NAME'

I've Googled around and suspect this might be a case where I need to set the JDBC driver with a parameter reading

jdbcCompliantTruncation=false

However, other searches come up with folks saying this does not help them.  My question is twofold.  First, if I'm running MySQL 5.0.19, should I be looking for a patch or upgrade?  

Second, can anyone point me to a workaround that would not necessitate a db patch/upgrade?  

Thanks!
Baldy
0
Comment
Question by:baldcode
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 6

Expert Comment

by:chigs20
ID: 17778516
I recommend upgrading to the newest version 5.0.26 as it has a several major fixes for stored procs and security patches.  Next, can you provide some more insight to your error...
1. does the insert statement work if you execute by itself
2. can you post what your cfmx data source info (name, driver, connection string, etc.)
3. is there anything in the mysql error log
0
 

Author Comment

by:baldcode
ID: 17778585
Oh, I neglected to mention the data type:  decimal 9, 2

The insert statement by itself is fine.  Usually, it works in the application.  

The datasource is specified by a variable...  not sure why the name would be important -- it's not a reserved word or anything.  The driver connection is pretty generic:

jdbc:mysql://127.0.0.1:3306/name_of_db

Would the truncation parameter need to go onto that?  If so, do I just add it with a question mark then the parameter?  

The mysql error log doesn't show anything.  Will look into the upgrade though!

- Baldy  
0
 
LVL 35

Expert Comment

by:Raynard7
ID: 17874863
Hi,

Because there is nothing going through the mysql error log the problem is unlikley to be on the mysql side.

If you are doing this as a parameterised query this could be the problem as there has been some documented bugs surrounding data truncation and jdbc.

Potentially you could just get jdbc to execute a query string - and then this should not truncate your data as jdbc is not doing any transposition.  additoinally if you did it this way then you could check that you could run your insert statement through the mysql client and if you got errors that way - if you did not then it should work through jdbc.
0
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 

Author Comment

by:baldcode
ID: 18038577
I'm still interested and have upped the points.  Adding the jdbcomplianttruncation=false parameter to the jdbc string does not stick on CFadmin where the datasource is set up.  I found this very odd.

My workaround thus far has been to include a ColdFusion function on the data inserted to force it to conform to the size the field is set to (2 decimal places).  Not my favorite solution as there could appear other queries later that have the same issue and will need the same treatment.  I'd rather the shotgun approach on this one.  

Oh, well.  If no other comments or suggestions, you could just close this out.

Thanks!
Baldy
0
 
LVL 35

Expert Comment

by:Raynard7
ID: 18040801
have you tried executing the query?
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 19539058
PAQed with points refunded (300)

Computer101
EE Admin
0

Featured Post

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating and Managing Databases with phpMyAdmin in cPanel.
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question