Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7745947
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T10:09:08+00:00 2026-06-01T10:09:08+00:00

I am executing the select statement with using jdbc sybase driver ( jconn3 ).

  • 0

I am executing the select statement with using jdbc sybase driver (jconn3). I checked the statement with executed manually on isql and all rows returned correctly. The statement which is executing on jdbc :

select * from mytable where date between ? and ?

I added the dateformat as yyyy-MM-dd HH:mm:ss and set the time value as 00:00:00 for begin date and 23:59:59 for end date.

It is not working. The row count must be 1000 but it is sometimes 770, sometimes 990, sometimes 564 etc.. There is no any specific row count which everytime returned.

After that I added an extra execution which returns only row count. First I am executing the select count(*) from ... statement then executing select * from .... and now `select * from … query returns the correct number of records everytime. This can not be related with caching. And weird thing is , I am using same preparedstatement and resultset objects for those two execution.

Any idea on that issue?

@Rulmeq, here is the code (added on 2012-03-29)

ResultSet rs = null;
PreparedStatement ps = null;

ps = myConn.getConnection().prepareStatement("select count(*) from myTable where date between ? and ?");
ps.setDate(1, new java.sql.Date(beginDate.getTime()));   // format : yyyy-MM-dd
ps.setDate(2, new java.sql.Date(endDate.getTime()));    // format : yyyy-MM-dd
rs = ps.executeQuery();
rs.next();
// some logs here

ps = myConn.getConnection().prepareStatement("select * from myTable where date between ? and ?");
ps.setTimestamp(1, new java.sql.Timestamp(beginDate.getTime()));    // format : yyyy-MM-dd hh:mm:ss  
ps.setTimestamp(2, new java.sql.Timestamp(endDate.getTime()));  // format : yyyy-MM-dd hh:mm:ss  
rs = ps.executeQuery();
while(rs.next()){
    ........
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T10:09:09+00:00Added an answer on June 1, 2026 at 10:09 am

    Thanks for all but issue has been solved and it was not related with jdbc. It was related with using System.currentTimeMillis() and host system is too fast. That’s why system sometime uses the same ms. I changed the references.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am executing a mysql SELECT statement which takes 30 seconds to run the
I'm having a performance issue with a select statement I'm executing. Here it is:
When executing the following using a smalldatetime constraint on the returned results, I get
So I have the following statement I'm executing in Microsoft SQL 2008: SELECT 'UTC'
I'm using using the sqljdbc4.jar (sqljdbc_2.0) version. I'm executing an insert + a select
I am having a problem when using an INSERT statement with a nested select.
I am getting Incorrect syntax near the keyword 'select' after executing the following code.
I'm getting a weird return when executing this query : SELECT * FROM rrp
I am currently using select() to act as a timer. I have network receive
I'm using following update or insert Oracle statement at the moment: BEGIN UPDATE DSMS

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.