rohanawaw Posted September 7, 2018 Posted September 7, 2018 (edited) i want to upload and import .sql file from jsp how to do it like mysql -user -pass dbname <file.sql from jsp Edited September 7, 2018 by rohanawaw Quote
wolstech Posted September 7, 2018 Posted September 7, 2018 You should be able to just read the file in, then execute all the queries inside in order as one big block of code. They are just plain text after all. We don't allow shell commands except through cron (and those are limited to 2 per day). Quote
rohanawaw Posted September 7, 2018 Author Posted September 7, 2018 (edited) can i use load inline query String sql= "LOAD DATA INFILE"+" 'f:/data4.txt'" +"INTO TABLE survey "+ " FIELDS TERMINATED BY ',' "+ " ENCLOSED BY '\"'"+ "LINES TERMINATED BY '\\r\\n'"+ "IGNORE 1 LINES"; statement.execute(sql); from java with remote . currently iam doing this it giving me erroraccess denied Edited September 7, 2018 by rohanawaw Quote
wolstech Posted September 7, 2018 Posted September 7, 2018 The file needs to be on the server, not your computer, so the file f:/data4.txt would never be accessible. Upload it to your home folder and point to the copy you uploaded there. It'll be found at either /home/username/data4.txt or /home1/username/data4.txt assuming you put it in the root of your home directory. Also, be aware that that function expects the data only, usually in comma separated form. It won't accept entire queries. Quote
rohanawaw Posted September 7, 2018 Author Posted September 7, 2018 (edited) LOAD DATA LOCAL INLINE LOCAL was missing this method inserted 10 million rows in just 15 sec Edited September 7, 2018 by rohanawaw Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.