• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JDBC into MySQL Import Error

 
Mike London
Ranch Hand
Posts: 1224
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why does MySQL consider: "2042-10-20 00:00:00" to be an invalid DateTime?

Other dates with the same format, including all zeros for the time portion, but not as far in the future, import fine.

The application we are working on looks (up to) 30 years into the future for some dates.

Need a way to "tell MySQL" this date is ... "OK".

Look forward to hearing back.

- mike
 
Mike London
Ranch Hand
Posts: 1224
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Thanks for the link. That is helpful, but I didn't see any workaround.

Storing timestamps in text fields is not a solution.

It looks like DateTime is the field type I need to use as it's quite relaxed...all the way to year 9999, which will be long enough for my career.

I was using the Timestamp field type to catch bad dates, but I can just now import all the data and use a different query to catch bad dates.

Thanks,

-mike
 
Brian Tkatch
Bartender
Posts: 567
25
Linux Notepad Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The rdbms bigot in me says to use a real database.

You could likely bifurcate the data into a DATE and TIME, assuming TIME is a valid data type. Otherwise, time could use a generic (ignored, but valid) date. Then use a function to connect them into the data you need.
 
K. Tsang
Bartender
Posts: 3583
16
Android Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually the DATETIME type is probably a better datatype to use.

The only thing regarding TIMESTAMP is it somewhat consider the time zone the DB is in during save/retrieve. Since you read the link provided I'm not quoting the relevant section.
 
Mike London
Ranch Hand
Posts: 1224
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
K. Tsang wrote:Actually the DATETIME type is probably a better datatype to use.

The only thing regarding TIMESTAMP is it somewhat consider the time zone the DB is in during save/retrieve. Since you read the link provided I'm not quoting the relevant section.


Great minds...

I was just posting the same solution.

Thanks very much.

- mike
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic