Solved

Capturing Date TimeStamp information

Posted on 2011-09-15
7
286 Views
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 12.00.00.000000000 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
0
Comment
Question by:abuyusuf35
  • 4
  • 2
7 Comments
 
LVL 86

Expert Comment

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

Expert Comment

by:ksivananth
ID: 36543025
you should be sending it as timestamp,

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

Author Comment

by:abuyusuf35
ID: 36543045
Sorry, forgot to mention we are using hibernate probably we are missing the Timestamp parameter ?
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 86

Accepted Solution

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

Author Comment

by:abuyusuf35
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
0
 
LVL 86

Expert Comment

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

Expert Comment

by:CEHJ
ID: 36575322
:)
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
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 setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

809 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