1

I am trying to connect to AWS RDS to my AWS EC2 application that is a zend framwork app using doctrine module to connect to mysql. I can successfuly connent to my AWS RDS database from mysql Workbench. Any help will be greatly appreciated. Her are some of stack traces:

PDOException
/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:40
SQLSTATE[HY000] [2002] Connection timed out
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php(40): PDO->__construct('mysql:host=doct...', 'user', 'password', Array)
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOMySql/Driver.php(41): Doctrine\DBAL\Driver\PDOConnection->__construct('mysql:host=doct...', 'user', 'password', Array)
 vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(356): Doctrine\DBAL\Driver\PDOMySql\Driver->connect(Array, 'user', 'password', Array)
 vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(680): Doctrine\DBAL\Connection->connect()
 vendor/doctrine/orm/lib/Doctrine/ORM/Query/Exec/SingleSelectExecutor.php(50): Doctrine\DBAL\Connection->executeQuery('SELECT COUNT(*)...', Array, Array, NULL)
vendor/doctrine/orm/lib/Doctrine/ORM/Query.php(286): Doctrine\ORM\Query\Exec\SingleSelectExecutor->execute(Object(Doctrine\DBAL\Connection), Array, Array)
vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php(794): Doctrine\ORM\Query->_doExecute()
vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php(598): Doctrine\ORM\AbstractQuery->execute(NULL, 3)
Oskar
  • 2,522
  • 32
  • 37

2 Answers2

0

Is it a complex query? Does the user has the proper rights to execute that query?

Don't think Doctrine is causing the problem, but it's the outbound firewall of the host you're executing the query from. Is that the same machine as Workbench is executed from?

Rvanlaak
  • 2,971
  • 20
  • 40
  • No, it is not. The same error shows in the different pages with different queries. No it's not the same machine. Workbench is installed in my ws machine and the app is on aws ec2 (linux server on the cloud ). – Oskar Jul 23 '15 at 17:31
0

My app in AWS listend only to my ip, and after changing this to any ip, the problem was solved. But for future visitor of this problem I should say that the doctrine is trying to connect without lac until it run out of time(30sk), and to aws visitor I should say that make sure your Instance and RDS are listening to each other ie. have the right security group. for further info check this: aws security groups :)

Oskar
  • 2,522
  • 32
  • 37
  • Can you be more clear about this? I'm having the same issue and cannot solve it. I've also added the certificate to my repository and passed it to Doctrine as explained here https://stackoverflow.com/a/40142725/1399706 But how can I set the IP? And the security group? Can you reference some documentation, please? – Aerendir Aug 01 '17 at 16:39