简体   繁体   中英

How to import data from CSV file into MySQL database

I have to import data from a CSV file into MySQL database using JSP/Servlet. While searching I got this link ! where it is said that we can use MySQL command "LOAD DATA INFILE ..." in hibernates createSQLQuery.

But in my case the table in which I need to upload the data is distributed on multiple database server. I would be getting a API through which I would get the connection to the database.

My query is, where should I save the CSV file -- in my tomcat server or on the system where I would be executing the "LOAD DATA INFILE ..." command.

CSV file should be saved on server running MySQL DB. Also access privileges should be set that the user which MySQL Server is run under is allowed to access this file.

You might also find article on LOAD DATA INFILE from MySQL docs useful.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM