Hello,
Here is my problem: I execute an SQL query and the result of the query is inserted in a file. I am trying to do it, but getting error in some conditions, first take a look at my code.
Code:
/ / Opening FileWriter
FileWriter fwri = new FileWriter("csv file");
/ / Route lines to update
while (reset.next()) {
/ / Route Tables
String userid = reset.getString(1);
String usr = reset.getString(2);
System.out.System.out.println("** = Userid" + Userid + "usr =" + usr);
/ / Elements to be included in the file
fwri.write(userid);
fwri.write(" ");
fwri.write(usr);
fwri.write('\ n');
}
/ / Close file written
fwri.close();
After trying for some time, it seems that the code does not like to work when the query returns a NULL (line column empty). So I did some testing on other non-empty columns and that worked file for me.
Bookmarks