We have a Java webapp that talks to an Oracle database. We are keeping track of a particular time (timestamp format in Oracle) and we were wondering what would be the best time format in java to use.
The da开发者_JAVA百科tabase we are talking to could be in the US or Europe so we need a java type that will allow us to use Locales.
What in peoples opinion would be the best Java type to use?
You should use java.sql.Timestamp
together with a PreparedStatement then you don't need to worry about a "format" at all.
What is the datatype of the Oracle field that you are storing timestamp?
Make sure it preserves timezone data.
精彩评论