Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I'm making a database query to a PostgreSQL server using Java and the corresponding JDBC driver.

The Query is:

select starttime, duration from callhistory3 where is_answ = 't' and callerid NOT IN ('PlayFile', 'anonymous') and NOT (char_length(callerid) = 3 AND char_length(dialednumber) = 3) ORDER BY starttime

Unfortunately the ResultSet is not sorted by starttime.

Example ResultSet:

2014-05-29 19:19:08,00:06:21.629
2014-05-29 19:52:19,00:00:02.71
2014-05-29 09:33:51,00:00:09.822
2014-05-29 10:38:52,00:00:03.026
2014-05-29 07:16:24,00:00:24.686
2014-05-29 07:35:58,00:00:55.013

If I use the same query in pgAdmin III, the result is sorted correctly.

Any idea how to get a sorted ResultSet without processing it in Java after the fact? Thanks.

share|improve this question
4  
This shouldn't be happening. Post the relevant part of your Java code. –  PM 77-1 Jun 4 at 19:03
    
What datatype is the column starttime? –  a_horse_with_no_name Jun 4 at 21:53
    
@a_horse_with_no_name The datatype for starttime is timestamp without time zone –  punkrocker27ka Jun 6 at 18:37

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.