Capturing Date TimeStamp information

Posted on 2011-09-15
Last Modified: 2012-05-12
Hi - We are trying to capture data time stamp information for auditing purposes - our code passes the date as Calendar.getInstance().getTime() which has this information but it always turns up as AM in the DB - the data type we are using is TIMESTAMP(6) and the DB is Oracle - should we be using a different data type ? Thanks
Question by:abuyusuf35
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
LVL 86

Expert Comment

ID: 36543013
How are you inserting the timestamp into the db?
LVL 26

Expert Comment

ID: 36543025
you should be sending it as timestamp,

ps.setTimestamp( index, new Timestamp( Calendar.getInstance().getTime() ) ) ;

Author Comment

ID: 36543045
Sorry, forgot to mention we are using hibernate probably we are missing the Timestamp parameter ?
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 86

Accepted Solution

CEHJ earned 500 total points
ID: 36543072
Check your mapping in Hibernate

Author Comment

ID: 36543085
I think I know what it is - changed the Hibernate type from Date to Timestamp now I see the time in the DB
LVL 86

Expert Comment

ID: 36543146
Good - so it was your mapping, as i said
LVL 86

Expert Comment

ID: 36575322

Featured Post

What Is Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question