Why do I receive an error when I execute the FETCH statement on a SQL Server database using Database Toolbox 3.4 (R2008a)?

5 views (last 30 days)
I am connecting to a SQL Server database using a JDBC driver with the Database Toolbox 3.4 (R2008a). When I execute the FETCH statement in the process of retrieving 70,000 records, I receive the following error message:
"GC overhead limit exceeded"

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 22 Aug 2012
This error is similar to a Java "OutOfMemory" Error. It occurs when the Java Virtual Machine (JVM) has terminated itself due to the large amount of time spent in garbage collection of objects.
For example, if more than 98% of the total time is spent in garbage collection and less than 2% of the heap is recovered, an OutOfMemoryError will be thrown. This feature is designed to prevent applications from running for an extended period of time while making little or no progress because the heap is too small.
Disabling this feature would eliminate this error message, and can be done by adding the following line to the java.opts file:
-XX:-UseGCOverheadLimit
If a java.opts file already exists on your MATLAB path, please add the above mentioned line to this file. If the file does not currently exist on your machine, please create a text file called java.opts with the appropriate content, and place this file in the location:
$MATLABROOT/bin/win32
where, $MATLABROOT is the MATLAB root directory and may be obtained by entering the command:
matlabroot
at the MATLAB command prompt.
Alternatively, you could also place the java.opts file in your MATLAB startup directory; however, be aware that changing your startup directory will stop MATLAB from using that java.opts file, so it is safer to include the file in the aforementioned location.
The MATLAB startup directory can be found by executing the following at the MATLAB Command Prompt (before any MATLAB code is executed):
>> pwd
Note: java.opts files can reside in the folder from which you launch MATLAB or in the bin/$ARCH subfolder within the MATLAB root folder. A java.opts file in the latter location applies to all users, but individual users might not have permissions to modify a java.opts file there. If there is a java.opts file in both locations with settings that conflict, the setting in the java.opts file in the folder from which you launch MATLAB takes precedence. You might want to check both locations to see whether you have existing java.opts files and then decide which one to modify.

More Answers (0)

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!