Problem getting Vertica to work with php PDO
Hello there, for the last two days, I've been struggling with a very strange bug while I'm connecting with Vertica using php PDO. You see, the following script works:
$stmt = $c->prepare("SELECT * FROM myClients WHERE ClientNum = 88");
$stmt->execute();
After that, I loop through the results and display them no problem. This basically means my connection is correct (otherwise I wouldn't get anything out of the database). On the other hand, the following makes the Apache server reset the connection completely (no error message whatsoever and nothing in the error log):
$stmt = $c->prepare("SELECT * FROM myClients WHERE ClientNum = :cl");
$stmt->bindValue(":cl", 88);
$stmt->execute();
The problem is present both in Linux and Windows and I'm using Vertica version 7.0.2-1 along with the corresponding ODBC driver. Did anyone ever get this error?
Thanks in advance,
Tobbi
$stmt = $c->prepare("SELECT * FROM myClients WHERE ClientNum = 88");
$stmt->execute();
After that, I loop through the results and display them no problem. This basically means my connection is correct (otherwise I wouldn't get anything out of the database). On the other hand, the following makes the Apache server reset the connection completely (no error message whatsoever and nothing in the error log):
$stmt = $c->prepare("SELECT * FROM myClients WHERE ClientNum = :cl");
$stmt->bindValue(":cl", 88);
$stmt->execute();
The problem is present both in Linux and Windows and I'm using Vertica version 7.0.2-1 along with the corresponding ODBC driver. Did anyone ever get this error?
Thanks in advance,
Tobbi
0
Comments
$c = new PDO("odbc:Driver=Vertica;Server=192.168.1.49;Port=5433;Database=db;", "MyUser", "MyPassword");
$c->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$c->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
//$c->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
try
{
$stmt = $c->prepare("SELECT * FROM myClients WHERE ClientNum = :cl");
$stmt->bindValue(":cl", 88);
$stmt->execute();
while($res = $stmt->fetch(PDO::FETCH_ASSOC))
{
echo $res['noClient'] . "<br>";
}
}
catch(Exception $e)
{
echo $e->getMessage();
}
http://stackoverflow.com/questions/26149956/vertica-and-pdo-prepared-statements/
I hope this helps.