Skip to main content
May 3, 2007
Question

Database Timestamp Conversion Error

  • May 3, 2007
  • 2 replies
  • 637 views
Hello,

I am trying to apply a simple timestamp on a form submit to the DB which is then returned as a part of the post ... pretty common, eh? 😃 However, It will not work because of the following Error:

Error Executing Database Query.
Cannot convert value '0000-00-00 00:00:00' from column 2 to TIMESTAMP

I am a:
-Novice CF User
-Newbie MySql User

The ver of MySql:

# Server version: 4.1.22-max-log
# MySQL client version: 5.0.27
# Protocol version: 10
# Server: (XVXVXVXV) via TCP/IP

All of my other queries function flawlessly, so the DSN from the CFML to the MySql DB is accurate.
It is a simple connection through a commercial hosting provider.
I have no clue how to even begin a more complex manual Java connection.

Any help is appreciated.

Thanks!
This topic has been closed for replies.

2 replies

Inspiring
May 4, 2007
according from mysql 5.0's documentation, timestamp no longer supported since version 5.0.
So, you must change/downgrade your JDBC or ODBC driver form 5.0 to 4.0, then problem will be solved. (recommended)
Or else u must change your timestamp to datetime. and the default value must be NULL instead of 0000-00-00 00:00:00 (just in case that you are using jdbc or ODBC 5.0)
Inspiring
May 4, 2007
post your query code to get more detailed help.

in general, to avoid such problems use CreateODBCDateTime or similar CF
function to create a timestamp for insertion into date/time field in
your table.

example:
<cfquery name="insertDateTime" datasource="somedsn">
INSERT INTO mytable (currenttimestamp) VALUES (#createodbcdatetime(now())#)
</cfquery>
--

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com