Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Not able Fetch Large Records  RSS feed

 
Prabhash Mishra
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,
    I am developing a restful we service for GET request.I am fetching 500 records from database and displaying XML response.But once i make a request url it is going into infinite loop after rs.next() method.the query is executing well in oracle scrapbook.Here is my code some column has not identified in database but it is present in my pojo class so i m filling some value manually.Query is giving result when i m running with eclipse scrapbook.

 
Dave Tolls
Ranch Hand
Posts: 2829
30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What exactly is going into an infinite loop?
Have you added some debugging statements in there to track exactly where it is going through that code?
 
Prabhash Mishra
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
After rs.next() i am putting SOP like this

while(rs.next())
System.out.println("1111111111111111111111");

Output:
1111111111111111111111
1111111111111111111111
1111111111111111111111
1111111111111111111111
1111111111111111111111
1111111111111111111111
1111111111111111111111
1111111111111111111111
1111111111111111111111
1111111111111111111111
1111111111111111111111

it is giving continuous this output after 10-15 min. it stops.I am connected with clients development database through vpn.At end there is no error because i m using logger no error.

Thanks
Prabhash
 
Dave Tolls
Ranch Hand
Posts: 2829
30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, so it's not an infinite loop.
And what happens if you replace the list of columns in the query with a count(*)?
Does the count match the number of lines you are currently seeing in your debug logging?

Finally, what exactly are you expecting to see as the output?
 
Prabhash Mishra
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Expected output with fewer records is coming like


There are thousands of <orders> under< orderhistory> tag.I am posting one of them
but when number of records are in thousands my postman crashes with no error.Can you confirm me how to make execution quickly.Please go through my code and suggest me how i can optimize code for fast result.

Thanks,
Prabhash
 
Prabhash Mishra
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Output:

 
Dave Tolls
Ranch Hand
Posts: 2829
30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So when you use Postman to post to that URL you get a timeout?

First I would look at some sort of keep-alive so at least it waits.
Then I would look at what exactly is taking the time.

Have you done an EXPLAIN on the query in order to see what plan it is using?
 
Prabhash Mishra
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
   When i am executing this query on sql developer it is taking 6 sec.With sql developer i am putting customerid  and storeid hard coded.But in jdbc i am using bond variable(?) as parameter.this is the only difference with running query on sql developer and jdbc.But in jdbc it is taking too much time.

Thanks,
Prabhash

Here is my DataSource Code:


Here is my orderdb.properties file:



Thanks
 
Dave Tolls
Ranch Hand
Posts: 2829
30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Note that SQL Developer is only retrieving about 50 rows, not all of them.

In addition it won't be using the same plan as the JDBC one, necessarily, since you are using actual values, and not binding them.
Copy and paste the actual SQL used in your code.
Rewriting it runs a large chance it will draw up a different plan as Oracle finds plans based on the actual SQL (formatting and all).

So first is to try it using bound values (not hard coded).  Ensure it is for values that take a long time in your server.
Then check the plan.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!