1

so i need to make a function which will take all datas from a table in my mysql. i've found the query (and it's working), but the problem is how to do it in java?

public void Print() {
    Database db = new Database();
    ResultSet rs = null;
    rs = db.getData("SELECT * FROM my_table"
            + "INTO OUTFILE 'E:\\kurtcobain.csv'"
            + "FIELDS TERMINATED BY ','"
            + "ENCLOSED BY '"'
            + "LINES TERMINATED BY '+\n+'");

i've try putting some quotation marks but still errors with "unclosed character literal" at line 7. any solutions? thanks before

1 Answer 1

1

check you codes .. there are missing (")

public void Print() {
    Database db = new Database();
    ResultSet rs = null;
    rs = db.getData("SELECT * FROM my_table"
            + "INTO OUTFILE 'E:\\kurtcobain.csv'"
            + "FIELDS TERMINATED BY ','"
            + "ENCLOSED BY '"'"
            + "LINES TERMINATED BY '+\n+'")";

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.