Richard de Koning wrote:
> I've done some troubleshooting and these are my preliminary
> conclusions.
>
> A ssh-tunnel is used to reach the remote MySQL database server that
> only runs on 127.0.0.1 (localhost).
> Commands sent to 127.0.0.1 port 3307 are forwarded to remote server on
> port 3306.
>
> When I connect with  MySQLdb.connect and  create an normal SQL-
> statement from a Python-script it works as it should.
> sql = "INSERT INTO data (fname, lname) VALUES ('%s', '%s') " % (fname,
> lname)
>
> So the problem must be somewhere in Sqlalchemy. Maybe it has anything
> to do with 'localhost'  somewhere in the code . When I initially ran
> the query on port 3307 the data was inserted in the local development-
> database that was running on the standard MySQL 3306 port. I'll use
> the normal SQL as a workaround, but I would prefer to do it in SA.
>
> Is this a known issue or should I report this as a bug?

SQLAlchemy calls MySQLdb.connect directly with the parameters you give it,
so nothing on SQLA end.   you would have to share with us the exact
parameters you pass to MySQLdb.connect, versus those you pass to
create_engine(), and the difference will be apparent.




>
>
>
> On Mar 25, 5:24 pm, Richard de Koning <richard1...@gmail.com> wrote:
>> I'm pretty new using sqlalchemy and I will probably ask some smart and
>> a lot of silly questions.
>>
>> At the moment I'm having problems with connecting to remote MySQL
>> databases. If I run the updates on a local database everything works
>> fine.
>>
>> When I try to connect to a remote database I keep getting the
>> following errors:
>>
>>   File "/usr/lib/pymodules/python2.6/sqlalchemy/pool.py", line 142, in
>> connect
>>     return _ConnectionFairy(self).checkout()
>>   File "/usr/lib/pymodules/python2.6/sqlalchemy/pool.py", line 304, in
>> __init__
>>     rec = self._connection_record = pool.get()
>>   File "/usr/lib/pymodules/python2.6/sqlalchemy/pool.py", line 161, in
>> get
>>     return self.do_get()
>>   File "/usr/lib/pymodules/python2.6/sqlalchemy/pool.py", line 639, in
>> do_get
>>     con = self.create_connection()
>>   File "/usr/lib/pymodules/python2.6/sqlalchemy/pool.py", line 122, in
>> create_connection
>>     return _ConnectionRecord(self)
>>   File "/usr/lib/pymodules/python2.6/sqlalchemy/pool.py", line 198, in
>> __init__
>>     self.connection = self.__connect()
>>   File "/usr/lib/pymodules/python2.6/sqlalchemy/pool.py", line 261, in
>> __connect
>>     connection = self.__pool._creator()
>>   File "/usr/lib/pymodules/python2.6/sqlalchemy/engine/strategies.py",
>> line 80, in connect
>>     raise exc.DBAPIError.instance(None, None, e)
>> OperationalError: (OperationalError) (2003, "Can't connect to MySQL
>> server on 'xxx.xxx.xxx.xxx' (111)") None None
>>
>> I checked the userrights. Tried with root and installed sqlalchemy and
>> python-bindings for mysql on the server. I also tried on several
>> servers with different OS-versions, but I can't see anything wrong.
>> Manual logins with mysql-client to the servers work.
>>
>> Can anybody give any pointers how to solve this?
>
> --
> You received this message because you are subscribed to the Google Groups
> "sqlalchemy" group.
> To post to this group, send email to sqlalch...@googlegroups.com.
> To unsubscribe from this group, send email to
> sqlalchemy+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/sqlalchemy?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to