Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7628789
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:39:47+00:00 2026-05-31T05:39:47+00:00

I have a cvs file which schema is, every field is surrounded with ,

  • 0

I have a cvs file which schema is, every field is surrounded with “, and seperated by , and every tuple is a newline with \n

So in my Java file, I wrote

                String path = "o.csv";
                String esquel = " LOAD DATA LOCAL INFILE " + path +
                            " INTO TABLE recommendations " +
                            " FIELDS TERMINATED BY \',\' ENCLOSED BY \'\"'" +
                            " LINES TERMINATED BY \'\\n\'";

And I execute the statement with the following statement

statement.executeUpdate(esquel);

But it throws an SQLException which says:

com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an
error in your SQL syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use near ‘o.csv INTO
TABLE recommendations FIELDS TERMINATED BY ‘,’ ENCLOSED BY ‘”‘ LINES’
at line 1

What is my error ?

I would be appreciate if you can help me.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T05:39:48+00:00Added an answer on May 31, 2026 at 5:39 am

    Oh I got it ! I didn’t surround my path file with ‘.

    New sql statement should be:

    String esquel = " LOAD DATA LOCAL INFILE '" + path +
                                "' INTO TABLE recommendations " +
                                " FIELDS TERMINATED BY \',\' ENCLOSED BY \'\"'" +
                                " LINES TERMINATED BY \'\\n\'";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a file in cvs that has Sticky Options set to -kk .
I have a dump of several Postgresql Tables in a selfcontained CSV file which
I have this code to read a CVS file. It reads each line, devides
How download cvs file with google authorization in google trends service - have to
Backdrop: I have a file hierarchy of cvs files for multiple locations named by
We have a cvs archive, and I can get any version of any file
I have a list of cities (simple cvs file) and I want to populate
Here is the scenario that I have. I have a cvs repository in one
I have several related CVS projects, and I'd like to move them into subdirectories
We have been working with CVS for years, and frequently find it useful to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.