I am reading a JSON file of roughly 6 GB using Java. The goal is to import all the JSON data into a MySQL database. The program runs fine for few initial records but then throws a java.lang.OutOfMemoryError
with message Java heap space error. I am using the JsonParser
class to read the file and using nextToken()
to read the next JSON token. The system on which the program is running has 8 GB RAM.
How do I insert all the data into the the MySQL database from the JSON dataset?