-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Prasad Budim Ram wrote:
Hi,
I have a JDBC application connecting to MySQL database. It was working
fine for the queries that retrieve small amounts of data. But when the
database contains 600,000 records and the query SELECT * is fired it
gives Java.lang.outofMemoryException. Can any of you help me out what could
be the problem?
Thanks,
Ram
By default, the JDBC driver has to cache all of the results in memory for every query. If you have 600,000 records, that can easily exceed the default heap space in most JVMs of around 16 megabytes. You can either extend the heap space (see your JVM docs, most take the '-Xmx64M' type of parameter to extend the heap, in the example given, to 64 megabytes), or use 'streaming' results (see the README for Connector/J 3.0.x), or re-think your solution. 99.99% of developers don't really need to bring an entire large table across the wire and work on it in Java. There are performance implications all around, and it is a best practice in all client/server/distributed computing applications to limit the data returned to a remote client to only what is absolutely needed.


-Mark
- -- MySQL 2003 Users Conference -> http://www.mysql.com/events/uc2003/

For technical support contracts, visit https://order.mysql.com/?ref=mmma

__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Mark Matthews <[EMAIL PROTECTED]>
/ /|_/ / // /\ \/ /_/ / /__ MySQL AB, Full-Time Developer - JDBC/Java
/_/ /_/\_, /___/\___\_\___/ Flossmoor (Chicago), IL USA
<___/ www.mysql.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.1.90 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQE+Jr1mtvXNTca6JD8RAr7HAJ9CMJWvvPiL1J+sYET0PQUjF5jCjQCgnuw4
2CxZcCidBycmgpq5UOvMdXo=
=514Z
-----END PGP SIGNATURE-----


---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



Reply via email to