Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

data truncation error / use jdbcCompliantTruncation?

Posted on 2006-10-20
8
Medium Priority
?
880 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
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Containers like Docker and Rocket are getting more popular every day. In my conversations with customers, they consistently ask what containers are and how they can use them in their environment. If you’re as curious as most people, read on. . .
In this article, we’ll look at how to deploy ProxySQL.
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 Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

604 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