Load data from CSV to mySQL database Java+hibernate+spring

Posted by mona on Stack Overflow See other posts from Stack Overflow or by mona
Published on 2012-06-02T22:35:33Z Indexed on 2012/06/02 22:41 UTC
Read the original article Hit count: 308

Filed under:
|
|
|
|

I am trying to load a CSV file in to mySQL database using Java+Hibernate+Spring. I am using the following query in the DAO to help me load in to the database:

entityManager.createQuery("LOAD DATA INFILE :fileName INTO TABLE test").setParameter("fileName", "C:\\samples\\test\\abcd.csv").executeUpdate();

I got some idea to use this from http://dev.mysql.com/doc/refman/5.1/en/load-data.html and how to import a csv file into a mysql from an hibernate+spring application?

But I am getting the error:

java.lang.IllegalArgumentException: node to traverse cannot be null!

Please help! Thanks

© Stack Overflow or respective owner

Related posts about java

Related posts about mysql