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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!