user744959
user744959

Reputation: 751

Streaming results of JDBC query with playframework and ebean

Is there a way (preferrably with Ebean) to get ResultSet streaming from the server? (like it is possible with JDBC ResultSet.setFetchSize).

Also, if possible, can the fetch size be adjusted dynamically on the same result list?

I am asking this beacause I am working on an async web service in Play framework and I would like to return (or stream) results to the clients as soon as possible like I understand that is possible with node.js.

I would like to use Postgresql as the database.

Upvotes: 2

Views: 934

Answers (2)

NAKANO Hideo
NAKANO Hideo

Reputation: 21

Try to add defaultFetchSize=-2147483648 to your mysql connection like:

jdbc:mysql://192.168.10.1/DBNAME?defaultFetchSize=-2147483648

Upvotes: 2

Pere Villega
Pere Villega

Reputation: 16439

What you want is Asynchronous processing of the request, in which you return the answer in several fragments. There is documentation about it for both Play 1.x and Play 2.0.

I may be wrong, but I believe it's not possible to stream directly from the request to the database, what you do is to create an asynchronous request to the database and, once you get the rows you wanted, you iterate the results and return the answer to the client. See the examples linked above.

Upvotes: 0

Related Questions