Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

difference between java.sql.time and java.sql.timestamp in java

 
reubin haz
Ranch Hand
Posts: 287
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a DB table, with a column of type Time.
I'm wondering in the JDBC, should I use java.sql.Time or java.sql.Timestamp to save this column value?

Which one is better? Thanks.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34410
346
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Depends on what you want to save. If just time, java.sql.Time. If date and time, TimeStamp.

The database time type implies just time, but the exact meaning could vary based on the database.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic