Problem in writing record to Berkeley DB
when i am writing 1033 record then it write successfully but when i am writing 5,00,000 record the it give following error
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at java.util.regex.Pattern.compile(Unknown Source)
at java.u开发者_运维问答til.regex.Pattern.<init>(Unknown Source)
at java.util.regex.Pattern.compile(Unknown Source)
at java.lang.String.split(Unknown Source)
at java.lang.String.split(Unknown Source)
at WriteDataUsingCursor.main(WriteDataUsingCursor.java:31)
The band-aid solution is to increase the heap size; see "How can I increase the JVM memory".
However, you may want to look into why your application is running out of memory. It may be keeping an in-memory of some or all of the data, and that may be the real cause of your problems. The general approach to tracking down this kind of problem is to use a memory profiler to figure our why it is using a lot of memory.
i think you are having this problem because you are using an embedded database and those are normally used when you have a small number of values, i would suggest using sql server or oracle 11g if you need to enter alot of values
精彩评论