connecting to mysql db on amazon rds

Viewed 14259

I am using python's MySQLdb module on a windows 7 machine and trying to connect to a remote database on Amazon RDS (SQL Server Express). Here is the simple connection scheme I am using to establish a connection, but it never works:

import MySQLdb

cnx= {'host': 'dbname.xxxxxxxxxxxx.us-west-1.rds.amazonaws.com',
  'username': 'username',
  'password': 'password',
  'db': 'dbname'}

db = MySQLdb.connect(cnx['host'],cnx['username'],cnx['password'], cnx['db'])

When i execute this connection script, it waits for a few seconds (10 to 15 secs mostly) and then gives out the following error:

OperationalError: (2003, "Can't connect to MySQL server on 'dbname.xxxx.us-west-1.rds.amazonaws.com' (10060)")

I have used sql server on localhost previously, and used to connect it using the same scheme and it worked always. Now, this is the first time I am dealing with a db on amazon rds and have no idea why this error is showing up..please help. Thanks.

1 Answers
Related