Actually when I trying to put 50000+ data into Vector then it gets out of memory.
How should I handle with it efficiently without change the Java Heap Space?
Debasis Jana
If you want to store integers for example, you should not use Vector() and then add elements by adding new Integer() objects to it. It wastes a lot of time for inboxing-outboxing and memory space because of storing whole objects.
The best way for this is to use arrays of primitive types, like int[] array. This is much faster and uses up significant less memory space. You already know the number of elements to store, so initializing the array to the correct size should be no problem. There is no need to have a "dynamically growable" array, such as Vector().
You can also use compression techniques if you need to store Strings. Just use String.intern() for example before storing it into your Vector (or better String[] array). Usually the strings that you get back from your resultset are all using up memory, even if they are the same. By using String.intern(), you will store each different String only once and for each additional string which is the same you store only the reference instead of the string itself. This takes much less memory.
If you still have problems, then you can use a compression technique like Winzip is using.