silverkid silverkid - 1 year ago 74
Java Question

Why do I get \N when executing INTO OUTFILE query?

I am connecting to a MySQL database using Java. I am executing this query:

String query =
"`Language Pref` " +
"ON tt2.msisdn = `language pref`.MDN " +
"INTO OUTFILE 'c:/test12226.csv' " +
"ENCLOSED BY '\"' " +

I am executing this query using executeQuery(query).

The CSV file generated is perfect except for the last column. In the original table called
Language Pref
the last column had some null or empty cells. In the CSV file, wherever there were these null cells in the original table language pref, I am getting "\N" instead of the null cells as should be.

How can I correct this?

Answer Source

Well, ,\n at the end of a line represents a null-value in the last column. So everything is fine.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download