Hi All, Iam trying to execute two queries which fetches lakhs of records. ** I have one Connection Object(Singleton Object). **I have two PREPAREDSTATEMENT objects for two queries.
I get this exception when the 2ND query is getting executed. When iam executing one query alone instead of two queries,its getting executed successfully. So,Problem, is here.When am executing both the queries one by one, am getting this exception.
I need both the ResultSets to be used simaltaneously.so, I CANNOT ** execute the FIRST query ** Do the needfull with the FIRST ResultSet. ** execute the SECOND Query ** Do the needful with the SECOND ResultSet.
Moreover there is nothing extra in my code.Am trying to execute the Queries.Thats it.....
Just to understand your requirement first,you get a resultset from the first query. This resultset would be the parameters for your second query for you to execute the second one.If I am write, and from the problem description you have given, your second query is causing the problems.You can try the below method.
Instead of fetching lakhs of records at once as a single resultset,you can retrieve the data from database in chunks.for example write a "for loop" and retrieve 1000 records per every loop.
There's no obvious reason you can't execute both queries at once, so please provide a more detailed description of your problem. Also, if you are getting OutOfMemory as your subject suggests, try increasing the JVM memory allocation using the appropriate JVM switches such as xmx and xms.