1

Today I was using a simple Java application to load a large size data into MySQL DB, and got a error below:

java.sql.SQLException: Syntax error or access violation message from server: "memory exhausted near ''Q1',2.34652631E10,'000','000',5.0519608E9,5.8128358E9,'000','000',8.2756818E9,2' at line 5332"

I've tried to modified the my.ini file to increase some point, however it doesn't work at all and actually the size of file is not so large, it's just a 14mb xls file, almost running out of idea, awaiting for any suggestion. Appreciate your help!

Kenshin
  • 11
  • 1
  • 2
  • Perhaps a duplicate question: http://stackoverflow.com/questions/4154363/memory-limit-exhausted – hooknc Apr 08 '11 at 20:29
  • no, the guy did not stick out his solution. – Kenshin Apr 08 '11 at 20:53
  • How large is the query you're running? 5332 lines of query suggests it's huge (unless that's the line in the java applet where the error occurs). – Marc B Apr 08 '11 at 21:18
  • Yes, 5332nd line is the place of the error being occurred, in fact there are 300000 lines data, but the whole size is less than 14mb – Kenshin Apr 08 '11 at 21:23
  • Can you post the code or an explanation of the java program? – dfb Apr 08 '11 at 22:19

1 Answers1

1

(Without the relevant parts of your code I can only guess, but here we go...)

From the error message, I will take a shot in the dark and guess that you are trying to load all of 300,000 rows in a single query, which is probably produced by concatenating a whole bunch of INSERT statements in a single string. A 14MB XLS file can become a lot bigger when translated into SQL statements and your server runs out of memory trying to parse the query.

To resolve this (in order of preference):

Community
  • 1
  • 1
thkala
  • 84,049
  • 23
  • 157
  • 201
  • It makes perfect sense, the third suggestion is fitting to me since I have to vary some data from the original xml file by the java code, many thanks to you! – Kenshin Apr 09 '11 at 10:11