IntelliJ open source
[Logo] JavaRanch » JavaRanch Saloon
  Search | FAQ | Recent Topics | Hot Topics
Register / Login


Reply Bookmark it! Watch this topic JavaRanch » Forums » Java » JDBC
 
RSS feed
 
New topic
Author

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

reubin haz
Ranch Hand

Joined: May 12, 2005
Messages: 249

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.

SCJA, SCJP5.0, SCBCD, SCWCD
Jeanne Boyarsky
internet detective
Sheriff

Joined: May 26, 2003
Messages: 17183

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.

[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]

"The set strikes me as something like the set of potatoes, radishes, farming, and lunch. " - a colleague's way of comparing both overlapping and disparate groups. made me laugh and thought of the ranch
 
 
 
Reply Bookmark it! Watch this topic JavaRanch » Forums » Java » JDBC
 
RSS feed
 
New topic
JProfiler
Get rid of your performance problems and memory leaks!

.