Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > SqlAlchemy: remote connection on problem on mysql database

Reply
Thread Tools

SqlAlchemy: remote connection on problem on mysql database

 
 
Massi
Guest
Posts: n/a
 
      07-09-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:(E-Mail Removed)/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!
 
Reply With Quote
 
 
 
 
Rebelo
Guest
Posts: n/a
 
      07-09-2010
from SQLAlchemy docs (http://www.sqlalchemy.org/docs/
dbengine.html#database-engine-options):
"
create_engine() URL Arguments

SQLAlchemy indicates the source of an Engine strictly via RFC-1738
style URLs, combined with optional keyword arguments to specify
options for the Engine. The form of the URL is:

dialect+driver://usernameassword@hostort/database
Dialect names include the identifying name of the SQLAlchemy dialect
which include sqlite, mysql, postgresql, oracle, mssql, and firebird.
The drivername is the name of the DBAPI to be used to connect to the
database using all lowercase letters. If not specified, a “default”
DBAPI will be imported if available - this default is typically the
most widely known driver available for that backend (i.e. cx_oracle,
pysqlite/sqlite3, psycopg2, mysqldb).
"

are you sure that phpmyadmin.myhost.com is your mysql server?
or are you missing port? usually its 3306. AFAIK


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Database Database Database Database scott93727@gmail.com Computer Information 0 09-27-2012 02:43 AM
DataBase DataBase DataBase DataBase scott93727@gmail.com Computer Information 0 09-26-2012 09:40 AM
Connecting Pc remote with database Mysql Beppe Java 1 04-13-2008 06:24 PM
using mysql client to read a file to create a table in a database in a mysql server julian Ruby 8 04-06-2006 10:29 AM
Remote Assistance fails to connect, remote remote host name could not be resolved Peter Sale Wireless Networking 1 12-11-2004 09:09 PM



Advertisments