Hi all,

Azure has just launched "Azure database for MySQL" a managed Mysql service. 
It's in PREVIEW state and I was giving it a try with our web2py based 
application.

Any user name you configure to connect to the database instance gets 
appended an "@database_name", so in our case it's something like 
'user@mnp-db'. This is creating a problem when connecting to database:

2017-06-08 13:49:45,437 - cmp - 114405 - models.db.py - 44 - <module> - 
ERROR - Exception generating DAL. Failure to connect, tried 5 times:
Traceback (most recent call last):
  File "/home/www-data/web2py/gluon/dal.py", line 7563, in __init__
    self._adapter = ADAPTERS[self._dbname](**kwargs)
  File "/home/www-data/web2py/gluon/dal.py", line 2573, in __init__
    if do_connect: self.reconnect()
  File "/home/www-data/web2py/gluon/dal.py", line 606, in reconnect
    self.connection = f()
  File "/home/www-data/web2py/gluon/dal.py", line 2571, in connector
    return self.driver.connect(**driver_args)
  File "/home/www-data/web2py/gluon/contrib/pymysql/__init__.py", line 93, 
in Connect
    return Connection(*args, **kwargs)
  File "/home/www-data/web2py/gluon/contrib/pymysql/connections.py", line 
575, in __init__
    self._connect()
  File "/home/www-data/web2py/gluon/contrib/pymysql/connections.py", line 
741, in _connect
    self._request_authentication()
  File "/home/www-data/web2py/gluon/contrib/pymysql/connections.py", line 
796, in _request_authentication
    self._send_authentication()
  File "/home/www-data/web2py/gluon/contrib/pymysql/connections.py", line 
845, in _send_authentication
    auth_packet.check_error()
  File "/home/www-data/web2py/gluon/contrib/pymysql/connections.py", line 
341, in check_error
    raise_mysql_exception(self.__data)
  File "/home/www-data/web2py/gluon/contrib/pymysql/err.py", line 142, in 
raise_mysql_exception
    _check_mysql_exception(errinfo)
  File "/home/www-data/web2py/gluon/contrib/pymysql/err.py", line 138, in 
_check_mysql_exception
    raise InternalError, (errno, errorvalue)
InternalError: (2001, u'The server name you tried cannot be found. Please 
use the correct name and retry. Please check your server name mnp.\x00')

The error is missleading as it's not related to the server name but to the 
fact the user name includes an "@". Encoding it as %40 in the URI is not 
solving the issue.

I was debugging inside pymysql when I relized I could change to 
MySQL-python. It worked fine.

So hopefully this will save some of you some time.

Another thing to consider is that this service is in PREVIEW state but from 
my point of view is more an ALPHA state: connections from virtual machines 
in same resource group that the database instance are reaching the database 
through the public IP address, via internet. It's not only a latency issue, 
nor a bandwith concern, also a privacy issue...

Best regards,
Raúl.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to