Re: MySQL 5 and date issues
Re: MySQL 5 and date issues
- Subject: Re: MySQL 5 and date issues
- From: Matt Hanlon <email@hidden>
- Date: Mon, 17 Jul 2006 15:28:05 -0400
Or you can just add &zeroDateTimeBehavior=convertToNull to the end of
your jdbc URL...
That should fix your problem.
some.connectionDictionary = {
URL = "jdbc:mysql://127.0.0.1/somedb?
capitalizeTypeNames=true&autoReconnect=true&maxReconnects=3&zeroDateTime
Behavior=convertToNull";
....
}
_m
oh yeah, happens all the time. There are more than a few
strangenesses about dates in Mysql. Make sure to assign your dates a
value, or else leave them as null. Make sure to create all timestamp
columns with default null onupdate null. (I think thats the right
syntax, you should check) If you don't, the first date column in
your table will default to current_timestamp, and it will magically
change itself on every update.
To recover from this situation, you'll need to manually fix the
values in the DB.
On Jul 17, 2006, at 1:53 PM, William Hatch wrote:
mySQL 5.0.18 with adaptor mysql-connector-java-3.1.12, WO 5.3.1 OSX
10.4.7
I'm just starting a new project using mySQL, and am running into
date issues. If I have an attribute that's external type is set to
DATE, and Java type is NSTimestamp, I'm able to insert values, but
when retrieving them I get the following exception.
I remember a few posts that touched on stricter date type issues
with mySQL 5, but can't seem to locate them worth a damned at the
moment;-) Does anybody have a fix or work around for this? Thanks.
<com.webobjects.appserver._private.WOComponentRequestHandler>:
Exception occurred while handling request:
com.webobjects.jdbcadaptor.JDBCAdaptorException: Value '0000-00-00'
can not be represented as java.sql.Date
[2006-07-17 13:51:30 EDT] <WorkerThread2>
com.webobjects.jdbcadaptor.JDBCAdaptorException: Value '0000-00-00'
can not be represented as java.sql.Date
at com.webobjects.jdbcadaptor.JDBCColumn._fetchValue
(JDBCColumn.java:325)
at com.webobjects.jdbcadaptor.JDBCColumn.fetchValue
(JDBCColumn.java:307)
at com.webobjects.jdbcadaptor.JDBCChannel.fetchRow
(JDBCChannel.java:1406)
at com.webobjects.eoaccess.EODatabaseChannel._fetchObject
(EODatabaseChannel.java:302)
at
com.webobjects.eoaccess.EODatabaseContext._objectsWithFetchSpecificat
i
onEditingContext(EODatabaseContext.java:3221)
at
com.webobjects.eoaccess.EODatabaseContext.objectsWithFetchSpecificati
o
n(EODatabaseContext.java:3346)
at
com.webobjects.eocontrol.EOObjectStoreCoordinator.objectsWithFetchSpe
c
ification(EOObjectStoreCoordinator.java:539)
at
com.webobjects.eocontrol.EOEditingContext.objectsWithFetchSpecificati
o
n(EOEditingContext.java:4114)
at com.webobjects.eoaccess.EODatabaseDataSource.fetchObjects
(EODatabaseDataSource.java:633)
at com.webobjects.appserver.WODisplayGroup.fetch
(WODisplayGroup.java:2191)
at com.webobjects.directtoweb.D2WListPage.setDataSource
(D2WListPage.java:196)
at com.webobjects.directtoweb.D2WQueryPage.queryAction
(D2WQueryPage.java:183)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at com.webobjects.foundation.NSKeyValueCoding$1.methodValue
(NSKeyValueCoding.java:684)
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.valueInCompon
e
nt(WOKeyValueAssociation.java:46)
at com.webobjects.appserver._private.WOActiveImage.invokeAction
(WOActiveImage.java:255)
at
com.webobjects.appserver._private.WODynamicGroup.invokeChildrenAction
(
WODynamicGroup.java:101)
at com.webobjects.appserver._private.WODynamicGroup.invokeAction
(WODynamicGroup.java:110)
at com.webobjects.appserver._private.WOForm.invokeAction
(WOForm.java:82)
at
com.webobjects.appserver._private.WODynamicGroup.invokeChildrenAction
(
WODynamicGroup.java:101)
at com.webobjects.appserver._private.WODynamicGroup.invokeAction
(WODynamicGroup.java:110)
at
com.webobjects.appserver._private.WOComponentContent.invokeAction
(WOComponentContent.java:31)
at
com.webobjects.appserver._private.WODynamicGroup.invokeChildrenAction
(
WODynamicGroup.java:101)
at com.webobjects.appserver._private.WODynamicGroup.invokeAction
(WODynamicGroup.java:110)
at
com.webobjects.appserver._private.WOHTMLURLValuedElement.invokeAction
(
WOHTMLURLValuedElement.java:115)
at
com.webobjects.appserver._private.WODynamicGroup.invokeChildrenAction
(
WODynamicGroup.java:101)
at com.webobjects.appserver._private.WODynamicGroup.invokeAction
(WODynamicGroup.java:110)
at com.webobjects.appserver.WOComponent.invokeAction
(WOComponent.java:945)
at
com.webobjects.appserver._private.WOComponentReference.invokeAction
(WOComponentReference.java:104)
at com.webobjects.appserver._private.WOSwitchComponent.invokeAction
(WOSwitchComponent.java:171)
at com.webobjects.appserver.WOComponent.invokeAction
(WOComponent.java:945)
at com.webobjects.appserver.WOSession.invokeAction(WOSession.java:
1168)
at com.webobjects.appserver.WOApplication.invokeAction
(WOApplication.java:1375)
at
com.webobjects.appserver._private.WOComponentRequestHandler._dispatch
W
ithPreparedPage(WOComponentRequestHandler.java:196)
at
com.webobjects.appserver._private.WOComponentRequestHandler._dispatch
W
ithPreparedSession(WOComponentRequestHandler.java:287)
at
com.webobjects.appserver._private.WOComponentRequestHandler._dispatch
W
ithPreparedApplication(WOComponentRequestHandler.java:322)
at
com.webobjects.appserver._private.WOComponentRequestHandler._handleRe
q
uest(WOComponentRequestHandler.java:358)
at
com.webobjects.appserver._private.WOComponentRequestHandler.handleReq
u
est(WOComponentRequestHandler.java:432)
at com.webobjects.appserver.WOApplication.dispatchRequest
(WOApplication.java:1306)
at com.webobjects.appserver._private.WOWorkerThread.runOnce
(WOWorkerThread.java:173)
at com.webobjects.appserver._private.WOWorkerThread.run
(WOWorkerThread.java:254)
at java.lang.Thread.run(Thread.java:552)
Bill
_______________________________________________
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