Selecting multiple data from the database at the same time

I am creating a java application that needs to collect loads of data, process the data into objects and return the objects as a list.

All of the data collected is from different tables in my database (some are joined but all of them are different SQL calls)

I was thinking of getting this data through different threads but since multiple threads cannot use the same connection to acess data in the database i would have to create a new connection for each of these threads.

My Question is: what is the best way to acess and process multiple data from database at the same time?

Answers


If you have enough memory I would use a full second level change that syncs to the database. Using a cache makes it extremely faster. If you won't have enough memory on the server/client you can cache your query on the sqlserver with a table that has all the values from your query and this table gets updated every second.

Otherwise you can use a Threadpool with Threads which inserts the queryresults into a shared object for the result.


Need Your Help

How to insert polygon with hole in WKT (well known text) format into postgis table?

postgresql polygon postgis

I have a table in postgis, which has 4 columns: ID, name, the_geom, SRID. I need to write an SQL query which will insert this exterior polygon (Element 1) in the table named "woods", ID = 44, the n...

Possible to create a temporary host entry on Heroku

heroku

Is it somehow possible to edit /etc/hosts on Heroku , through the buildpack or otherwise?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.