MySQL-export recordset to local machine

I’m searching around other sources trying to find a solution to this but not having much luck. I want my client app to be able to save a recordset to a local machine. I can do it to the server using SELECT…TO OUTFILE but I would prefer they save the file to their local machine. I’m stumped. Starting to think I might have to loop through the recordset and build my own file. Could use some suggestions. Thanks!

You’re right, SELECT … INTO OUTFILE creates a file on the server where MySQL is running (and it requires the FILE privilege to do so).

Looping through the recordset is very likely the better option. Create a TextOutputStream object, loop over your recordset, create a new line for each record and use TextOutputStream.WriteLine to write it to your file.

Thanks, yea, I did the create my own solution writing to a file and it was easier than the effort I made trying to avoid it.