>>> Now, I use java.sql.Timestamp to map column_login_time field whose
>>> type is also timestamp in Mysql.
>> ...
>>> I set the column type in database as TIMESTAMP, and use
>>> java.sql.Timestamp in my Java source code.
>>> Here appends my codes(fragment):
Lew wrote:
>> Be aware:
>>
>>> MySQL has a type called TIMESTAMP, but it is quite different from the standard TIMESTAMP: It's a 'magic' data type with side effects in that it's automatically updated to the current date and time if some criteria are fulfilled.
>>> MySQL has a type called DATETIME. Like MySQL's TIMESTAMP type, it stores a combination of date and time without fractional seconds. There are no side effects associated with the DATETIME type-which makes it the closest match to the SQL standard's TIMESTAMP type.
>> from <http://troels.arvin.dk/db/rdbms/#data_types-date_and_time-timestamp>
> Thanks, Lew! But according to my practise, it was not the same as what
> you told!
It's not what I told, it's what's so. I merely conveyed the quoted information.
> I insert the timestamp value via JDBC, and the timestamp instance is
> generated in Java before inserting!
Then that is not the MySQL TIMESTAMP but the Java class Timestamp (not
"timestamp").
> Although MySQL's TIMESTAMP is a 'magic' data type, but it doesn't make
> sense.
I do not know what you mean by this sentence.
> btw, new Timestamp(System.currentTimeMillis() - 1000*60*60*24)) will
> always generate an instance base on current date and time.
The Java type is conformant to the SQL standard. The warning is that the
MySQL TIMESTAMP type is not.

Signature
Lew
Cao Yi - 09 Jul 2007 09:12 GMT
> >>> Now, I use java.sql.Timestamp to map column_login_time field whose
> >>> type is also timestamp in Mysql.
[quoted text clipped - 32 lines]
> --
> Lew
Hi, Lew, I got it! You're right! Thanks for your telling me the
details of TIMESTAMP.
I noticed that "I merely conveyed the quoted information." below. I
made a mistake before, sorry.