The below code works with directly with PHP's PDO but if I use Zend\Db\Adapter it is throwing an error. The first try block does not work while the second one works fine and all data gets imported.
try {
$dbAdapter = $this->getServiceLocator()->get('Zend\Db\Adapter\Adapter');
$result = $dbAdapter->query("LOAD DATA INFILE '?' INTO TABLE users FIELDS TERMINATED BY ',' ENCLOSED BY '" . '"' . "' LINES TERMINATED BY '
' IGNORE 1 LINES",
array('/tmp/feed.csv'));
} catch (PDOException $e) {
print "Error1!: " . $e->getMessage() . "<br/>";
}
try {
$dbh = new PDO('mysql:host=localhost;dbname=myapps_test', 'myapps_test_user', 'pwd');
$result = $dbh->exec("LOAD DATA INFILE '/tmp/feed.csv' INTO TABLE users FIELDS TERMINATED BY ',' ENCLOSED BY '" . '"' . "' LINES TERMINATED BY '
' IGNORE 1 LINES");
$dbh = null;
} catch (PDOException $e) {
print "Error2!: " . $e->getMessage() . "<br/>";
}
The error I get for the first try block:
Zend\Db\Adapter\Exception\InvalidQueryException: Statement could not be executed
Caused by
PDOException: SQLSTATE[HY000]: General error: 13 Can't get stat of '/db/dev/mysqldata/myapps_test/?' (Errcode: 2)
The location /db/dev/mysqldata/myapps_test is where the mysql server's database files are located.