Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to query AWS Redshift with PHP's PDO Postgres driver?

I can't find any information relating to this on Amazon's site, but is this possible?

like image 790
NobleUplift Avatar asked Dec 17 '14 21:12

NobleUplift


2 Answers

Sure you can,

I am using PHP PostgreSQL to query AWS Redshift

like image 143
The Monitoring Guy Avatar answered Nov 03 '22 00:11

The Monitoring Guy


For those who are looking for examples:

$connection = new PDO(
    'pgsql:dbname=<db_name>;host=<redshift_cluster_host>;port=5439',
    '<master_user_name>', 
    '<master_user_password>'
);

$statement = $connection->prepare('<your_query>');
$statement->execute();
$result = $statement->fetch();

Also, ensure you configured your cluster security groups correctly (under Security tab in the AWS Redshift admin).

like image 24
Ihor Burlachenko Avatar answered Nov 03 '22 00:11

Ihor Burlachenko