SqlAlchemy: remote connection on problem on mysql database

Massi massi_srb at msn.com
Fri Jul 9 11:07:23 EDT 2010


Hi everyone,

in my script I'm trying to connect to a remote database using
sqlalchemy. Since I'm pretty new to this library I'm not really sure
of what I am doing :-). Up to now what I'm doing to connect to the
database is this:

engine = create_engine("mysql://
my_username:my_password at phpmyadmin.myhost.com/my_db_name")
metadata = MetaData(engine, reflect=True)

If I run this script I get the following error:

Traceback (most recent call last):
  File "C:\Documents and Settings\pc2\Desktop\prova.py", line 9, in
<module>
    metadata = MetaData(engine, reflect=True)
  File "C:\Python25\lib\site-packages\sqlalchemy-0.6.0-py2.5.egg
\sqlalchemy\schema.py", line 1770, in __init__
    self.reflect()
  File "C:\Python25\lib\site-packages\sqlalchemy-0.6.0-py2.5.egg
\sqlalchemy\schema.py", line 1879, in reflect
    connection=conn))
  File "c:\python25\lib\site-packages\SQLAlchemy-0.6.0-py2.5.egg
\sqlalchemy\engine\base.py", line 1604, in table_names
    conn = self.contextual_connect()
  File "c:\python25\lib\site-packages\SQLAlchemy-0.6.0-py2.5.egg
\sqlalchemy\engine\base.py", line 1592, in contextual_connect
    return self.Connection(self, self.pool.connect(),
close_with_result=close_with_result, **kwargs)
  File "c:\python25\lib\site-packages\SQLAlchemy-0.6.0-py2.5.egg
\sqlalchemy\pool.py", line 154, in connect
    return _ConnectionFairy(self).checkout()
  File "c:\python25\lib\site-packages\SQLAlchemy-0.6.0-py2.5.egg
\sqlalchemy\pool.py", line 318, in __init__
    rec = self._connection_record = pool.get()
  File "c:\python25\lib\site-packages\SQLAlchemy-0.6.0-py2.5.egg
\sqlalchemy\pool.py", line 173, in get
    return self.do_get()
  File "c:\python25\lib\site-packages\SQLAlchemy-0.6.0-py2.5.egg
\sqlalchemy\pool.py", line 665, in do_get
    con = self.create_connection()
  File "c:\python25\lib\site-packages\SQLAlchemy-0.6.0-py2.5.egg
\sqlalchemy\pool.py", line 134, in create_connection
    return _ConnectionRecord(self)
  File "c:\python25\lib\site-packages\SQLAlchemy-0.6.0-py2.5.egg
\sqlalchemy\pool.py", line 209, in __init__
    self.connection = self.__connect()
  File "c:\python25\lib\site-packages\SQLAlchemy-0.6.0-py2.5.egg
\sqlalchemy\pool.py", line 271, in __connect
    connection = self.__pool._creator()
  File "c:\python25\lib\site-packages\SQLAlchemy-0.6.0-py2.5.egg
\sqlalchemy\engine\strategies.py", line 76, in connect
    return dialect.connect(*cargs, **cparams)
  File "c:\python25\lib\site-packages\SQLAlchemy-0.6.0-py2.5.egg
\sqlalchemy\engine\default.py", line 227, in connect
    return self.dbapi.connect(*cargs, **cparams)
  File "C:\Python25\lib\site-packages\MySQLdb\__init__.py", line 74,
in Connect
    return Connection(*args, **kwargs)
  File "C:\Python25\lib\site-packages\MySQLdb\connections.py", line
170, in __init__
    super(Connection, self).__init__(*args, **kwargs2)
OperationalError: (OperationalError) (2003, "Can't connect to MySQL
server on 'phpmyadmin.myhost.com' (10060)") None None

Is there something I am missing? thanks in advance for the help!



More information about the Python-list mailing list