Is it possible to query AWS Redshift with PHP'

2020-06-20 23:40发布

问题:

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