The Vertica Forum recently got a makeover! Let us know what you think by filling out this short survey.

Querying Vertica using PHP PDO PostgreSQL, is it possible?

Hello,

I'm on FreeBSD with PHP. As I mentioned in this topic - https://community.vertica.com/vertica/topics/odbc_driver_for_freebsd I was unable to find solution to use Vertica ODBC driver with FreeBSD. So, now I'm looking for another ways to query Vertica from PHP.

In this stackoverflow topic http://stackoverflow.com/questions/13327948/connecting-to-a-vertica-db-with-php/13394911#13394911 @deadrunk told that it is possible to use Postgres client libs to connect Vertica.

I've tried using pgsql for PDO. Connection is ok, but querying seems to be faild with no errors. Do anybody know any information about how to do it properly? Here is the piece of code I was using:
$PDO = new \PDO('pgsql:dbname=mydb;host=myhost;port=5433', 'dbadmin', 'test');  $sth = $PDO->prepare('SELECT table_name FROM tables');  $sth->execute();  $result = $sth->fetch(\PDO::FETCH_ASSOC);  print_r($result);
Result contains nothing.
PS: I'm very sorry, I'm pretty new to Vertica.

Thank you!

Comments

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file

Can't find what you're looking for? Search the Vertica Documentation, Knowledge Base, or Blog for more information.