A quick google around (mysql Data truncation: Data truncated for column) shows 
it might be a fairly common problem. Maybe your drivers are different between 
dev/deploy?

Maybe this provides a work-around?

http://bugs.mysql.com/bug.php?id=7829

[12 Jan 2005 15:28] Mark Matthews
If you don't want truncation checked for, add 'jdbcCompliantTruncation=false' 
to your JDBC
url, and the driver will act as Connector/J 3.0 did.

Always a good idea to check the CHANGES file that comes with the driver when 
upgrading:

"- The driver is more strict about truncation of numerics on 
      ResultSet.get*(), and will throw a SQLException when truncation is
      detected. You can disable this by setting 'jdbcCompliantTruncation' to
      false (it is enabled by default, as this functionality is required
      for JDBC compliance)."


On 2011-07-14, at 10:23 AM, Lars Sonchocky-Helldorf wrote:

> Hi everybody!
> 
> 
> When running one of our application on our staging server I get Database 
> Exceptions like this:
> 
> Jul 14 16:57:23 PortalWonderTest[2100] DEBUG NSLog  -  === Begin Internal 
> Transaction
> Jul 14 16:57:23 PortalWonderTest[2100] DEBUG NSLog  -  evaluateExpression: 
> <com.webobjects.jdbcadaptor.MySQLPlugIn$MySQLExpression: "UPDATE TERMIN SET 
> mailToInterviewer = ? WHERE TERMINID = ?" withBindings: 1:2011-07-14 
> 16:57:23(mailToInterviewer), 2:14478(terminid)>
> Jul 14 16:57:23 PortalWonderTest[2100] INFO  
> er.transaction.adaptor.Exceptions  - Database Exception occured: 
> com.webobjects.eoaccess.EOGeneralAdaptorException: EvaluateExpression failed: 
> <com.webobjects.jdbcadaptor.MySQLPlugIn$MySQLExpression: "UPDATE TERMIN SET 
> mailToInterviewer = ? WHERE TERMINID = ?" withBindings: 1:2011-07-14 
> 16:57:23(mailToInterviewer), 2:14478(terminid)>:
>   Next exception:SQL Warning:22001 -- error code: 0 -- msg: Data truncation: 
> Data truncated for column 'mailToInterviewer' at row 1
> Jul 14 16:57:23 PortalWonderTest[2100] DEBUG NSLog  -  === Rollback Internal 
> Transaction
> Jul 14 16:57:23 PortalWonderTest[2100] ERROR 
> er.extensions.appserver.ERXApplication  - Exception caught: 
> java.lang.reflect.InvocationTargetException
> 
> full log here:
> 
> <Data truncation.log>
> 
> 
> The strange thing about this is that when I am trying to reproduce this 
> locally I don't run into an Exception, the same SQL is generated and 
> processed nicely. Also, if I run the SQL:
> 
> UPDATE TERMIN SET mailToInterviewer = '2011-07-14 16:57:23' WHERE TERMINID = 
> '14478'
> 
> in Sequel Pro I get the expected result without any problems.
> 
> 
> The column is of type DATE. 
> 
> 
> Previously, the attribute was defined like the following in the EOModel:
> 
>       {
>            allowsNull = Y; 
>            columnName = mailToInterviewer; 
>            externalType = DATE; 
>            name = mailToInterviewer; 
>            prototypeName = creationDate; 
>        }, 
> 
> where creationDate was erroneously chosen as prototype:
> 
>        {
>            allowsNull = Y; 
>            columnName = ERSTELLTAM; 
>            externalType = DATETIME; 
>            name = creationDate; 
>            valueClassName = NSCalendarDate; 
>        }, 
> 
> So I thought that the definition of creationDate as DATETIME conflicted with 
> the column type DATE (and causes the truncation of "2011-07-14 16:57:23")
> 
> So I changed this to:
> 
>        {
>            allowsNull = Y; 
>            className = "com.webobjects.foundation.NSTimestamp"; 
>            columnName = mailToInterviewer; 
>            externalType = DATE; 
>            name = mailToInterviewer; 
>        }, 
> 
> but it still didn't work. Changing it to
> 
>        {
>            allowsNull = Y; 
>            className = NSCalendarDate; 
>            columnName = mailToInterviewer; 
>            externalType = DATE; 
>            name = mailToInterviewer; 
>        }, 
> 
> like all the other date attributes in the model doesn't work either. As I 
> said only on the staging and live machine. Everything of the above DID WORK 
> on my development machine.
> 
> 
> 
> Has somebody any clues?
> 
> 
> cheers,
> 
>       Lars
> 
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list      ([email protected])
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/webobjects-dev/programmingosx%40mac.com
> 
> This email sent to [email protected]

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to