I have a bit of perl code that ends with an error:
$sql="SELECT convert_tz( a.stamp,'GMT','$tz' ) as ts, a.status,
INTO OUTFILE '/application/result.csv'
FIELDS TERMINATED BY ','
ENCLOSED BY '\"'
LINES TERMINATED BY '\n'
FROM alerts a
WHERE a.stamp BETWEEN ? AND ?
ORDER BY a.stamp DESC";
$sth = $dbh->prepare($sql);
$rv = $sth->execute;
DBD::mysql::st execute failed: Can't create/write to file
'/application/result.csv' (Errcode: 2)
Te database is remote from the system where the perl is executing.
Te SQL works as expected when fed to mysql command line client
(i.e. mysql -h remote). The outfile ends up in the application
directory of the macine running the mysql client.
What I'd found is, when the perl code runs the file tries to drop on the
database server and the application directory doesn't exist there giving
me the error.
Any suggestions to get the outfile to drop in the right place would be