Re: UTF8, MySQL, and JDBC
Re: UTF8, MySQL, and JDBC
- Subject: Re: UTF8, MySQL, and JDBC
- From: Dev WO <email@hidden>
- Date: Wed, 30 Aug 2006 23:07:21 +0200
Hi Matt,
which version of MySQL are you using?
are you updating from a 4.0.x to a 4.1.x?
Xavier
I think this problem is a bit weirder than I originally suspected.
I'm occasionally getting the following error. Removing UTF8 characters
seems to prevent it, but sometimes it'll save a multi-be character
anyway.
Its complaining that the column isn't long enough but its definitely
long enough. Its a text field which should be able to store some 65k
characters.
Any ideas? I'm stumped.
thanks,
matt
[2006-08-30 14:29:51 EDT] <WorkerThread0> evaluateExpression:
<com.webobjects.jdbcadaptor.MySQLPlugIn$MySQLExpression: "UPDATE
abExhibition SET description = ? WHERE _rowID = ?" withBindings:
1:"Nicole Klagsbrun Gal...
of American Art.
"(descriptionLong), 2:1230(rowid)>
[2006-08-30 14:29:51 EDT] <WorkerThread0>
com.webobjects.eoaccess.EOGeneralAdaptorException: EvaluateExpression
failed: <com.webobjects.jdbcadaptor.MySQLPlugIn$MySQLExpression:
"UPDATE abExhibition SET description = ? WHERE _rowID = ?"
withBindings: 1:"Nicole Klagsbrun Gal...
of American Art.
"(descriptionLong), 2:1230(rowid)>:
Next exception:SQL Warning:01004 -- error code: 0 -- msg: Data
truncation: Data too long for column 'description' at row 1
at
com.webobjects.eoaccess.EODatabaseContext._exceptionWithDatabaseContex
tInformationAdded(EODatabaseContext.java:4685)
at com.webobjects.eoaccess.EODatabaseContext.performChanges
(EODatabaseContext.java:6393)
at
com.webobjects.eocontrol.EOObjectStoreCoordinator.saveChangesInEditing
Context(EOObjectStoreCoordinator.java:415)
at com.webobjects.eocontrol.EOEditingContext.saveChanges
(EOEditingContext.java:3226)
at exhibitionSubmitForm.saveChanges(exhibitionSubmitForm.java:129)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.Nat[2006-08-30 14:29:51 EDT] <WorkerThread0> ===
Rollback Internal Transaction
[2006-08-30 14:29:51 EDT] <WorkerThread0>
<com.webobjects.appserver._private.WOComponentRequestHandler>:
Exception occurred while handling request:
com.webobjects.eoaccess.EOGeneralAdaptorException: EvaluateExpression
failed: <com.webobjects.jdbcadaptor.MySQLPlugIn$MySQLExpression:
"UPDATE abExhibition SET description = ? WHERE _rowID = ?"
withBindings: 1:"Nicole Klagsbrun Gal...
of American Art.
"(descriptionLong), 2:1230(rowid)>:
Next exception:SQL Warning:01004 -- error code: 0 -- msg: Data
truncation: Data too long for column 'description' at row 1
iveMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at KeyValueCodingProtectedAccessor.methodValue
(KeyValueCodingProtectedAccessor.java:54)
at com.webobjects.foundation.NSKeyValueCoding
$_MethodBinding.valueInObject(NSKeyValueCoding.java:1160)
at com.webobjects.foundation.NSKeyValueCoding
$DefaultImplementation.valueForKey(NSKeyValueCoding.java:1268)
at com.webobjects.appserver.WOComponent.valueForKey
(WOComponent.java:1539)
at com.webobjects.foundation.NSKeyValueCoding$Utility.valueForKey
(NSKeyValueCoding.java:498)
at com.webobjects.foundation.NSKeyValueCodingAdditions
$DefaultImplementation.valueForKeyPath
(NSKeyValueCodingAdditions.java:212)
at com.webobjects.appserver.WOComponent.valueForKeyPath
(WOComponent.java:1600)
at
com.webobjects.appserver._private.WOKeyValueAssociation.valueInCompone
nt(WOKeyValueAssociation.java:46)
at com.webobjects.appserver._private.WOSubmitButton.invokeAction
(WOSubmitButton.java:59)
I think you've got everything. If you still have some issue, you
should be
checking how to convert the text encoding on existing field in the
database
as they were probably not UTF-8 at the beginning...maybe try to
dump the
database, drop it recreate it 'making sure it's UTF-8 thanks to
the my.cnf
parameters).
Xavier
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden