This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes JDBC and the fly likes Data Retrieval Time Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Data Retrieval Time" Watch "Data Retrieval Time" New topic
Author

Data Retrieval Time

Andy Smith
Ranch Hand

Joined: Sep 28, 2003
Posts: 239
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


Share Knowledge to gain it.
SCJP 2, SCWCD 2, SCDJWS, IBM 141 (In Progress), IBM 486 (Next)
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 29287
    
140

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.


[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
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
My suggestion is to do the real query and get the date from javacode.
May be using System.currentTimeMillis().
Andy Smith
Ranch Hand

Joined: Sep 28, 2003
Posts: 239
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
internet detective
Marshal

Joined: May 26, 2003
Posts: 29287
    
140

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Data Retrieval Time
 
Similar Threads
how to display dynamic data in an editor
sql query regarding
Retrieving the Query after values are set in Prepared Statement
Need to run dynamic query using Mybatis
Database access using Java Script