For some reason, attempted connection to a mysql v4.1.25 db on FreeBSD
fails. The web2py is the latest version - but it happened on earlier
versions also. The error & db.py for the application failing looks
like this:
Error traceback
Traceback (most recent call last):
File "/m/content/www/data/web2py-1-79-2/gluon/restricted.py", line
178, in restricted
exec ccode in environment
File "/m/content/www/data/web2py-1-79-2/applications/myapp/models/
db.py", line 15, in <module>
db = DAL('mysql://login:[email protected]/myapp') # use mySQL
File "/m/content/www/data/web2py-1-79-2/gluon/sql.py", line 3855, in
DAL
raise RuntimeError, "Failure to connect to DB. Tried 5 times"
RuntimeError: Failure to connect to DB. Tried 5 times
In file: /m/content/www/data/web2py-1-79-2/applications/myapp/models/
db.py
# -*- coding: utf-8 -*-
#########################################################################
## This scaffolding model makes your app work on Google App Engine too
#########################################################################
if request.env.web2py_runtime_gae: # if running on Google
App Engine
db = DAL('gae') # connect to Google
BigTable
session.connect(request, response, db=db) # and store sessions and
tickets there
else: # else use a normal
relational database
db = DAL('mysql://login:[email protected]/myapp') # use mySQL
=====
Now if I comment out line 934 in gluon/sql.py, it connects without
error! The line looks like this:
self._execute("SET sql_mode='NO_BACKSLASH_ESCAPES';")
This has been the case from rel. 1.76 to current 1.79.2. Any ideas
about this error & work around. I don't always remember to make the
change for new releases and that causes unnecessary delay .
Thanks.