Java – How do I get 1.7 million records in Java?

How do I get 1.7 million records in Java?… here is a solution to the problem.

How do I get 1.7 million records in Java?

I’m using a MySQL database with 1.7 million records on one of the tables. With the ReSTLet framework in Java, I want to get these records and return them to the client. I’m using a remote server, Linux Centos. I have created a WAR file and uploaded it to the server. When I run the service, it takes a lot of time to respond. I waited 40 minutes but didn’t get any output.
So can someone help me with this?

Solution

This may not work: keeping so many rows of data in memory can cause an out-of-memory exception (can you look at the logs on the server and see what exactly happened?). )。

To do this, you’ll either need to abandon the plan and do some kind of paging, or you need a solution that allows you to stream records to clients without keeping them in memory. I’m not sure if the ReSTLet framework allows you to do this: you may need to implement it yourself using servlets.

Related Problems and Solutions