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?
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.