This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
The moose likes JDBC and Relational Databases and the fly likes difference between java.sql.time and java.sql.timestamp in java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "difference between java.sql.time and java.sql.timestamp in java" Watch "difference between java.sql.time and java.sql.timestamp in java" New topic
Author

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

reubin haz
Ranch Hand

Joined: May 12, 2005
Posts: 287
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
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 32305
    
213

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.


[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: difference between java.sql.time and java.sql.timestamp in java
 
jQuery in Action, 3rd edition