Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Data Retrieval Time

 
Andy Smith
Ranch Hand
Posts: 239
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI ,
I m firing a query to retrive some data...
I also need the time when the data was retirived...

One way is to include the sysdate inquery, but if my query is returning 1000's of records then i will get redundant data,,,

is there any other nice way?
Thax
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34372
345
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Andy,
If you are using JDBC, you can just get the date through Java and store it somewhere?

If not, I recommend doing two queries. Get the date and the do your real query. You can get the date again afterwards if you want to make sure too much time didn't pass in between.
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My suggestion is to do the real query and get the date from javacode.
May be using System.currentTimeMillis().
 
Andy Smith
Ranch Hand
Posts: 239
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i dont want to retrieve the date/time in Java due to following reasons:

1. My application may run on different machines, so there is no gurrantee that they all will have the same time. But they all will access the same DB so thats y i want DB time

2. There is always a diff. between the time when i retrieved the records and when i collected the sys date.. My application can not affored to miss even fraction of seconds.

So please any soulution now?
thx
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34372
345
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Andy,
In that case, you are going to have to deal with the redundant data and get the date with each row. You may still be off by a fraction of a second due to the time of the query execution itself though.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic