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

邮差的信 提交于 2019-12-05 00:19:21

问题


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


回答1:


Sure you can,

I am using PHP PostgreSQL to query AWS Redshift




回答2:


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).



来源:https://stackoverflow.com/questions/27535392/is-it-possible-to-query-aws-redshift-with-phps-pdo-postgres-driver

工具导航Map