Massimo,

    It is working now. I am not sure what could be the cause, as I
have not changed anything in db.py.  What I have done differently is
delete databases/ and errors/ reload apache, and chowned all the files
to www-data.  As for the db, it only had the Auth tables (with no
modifications) and an additional table for contacts that was
generating the following sql code:

CREATE TABLE contact(
        id INT AUTO_INCREMENT NOT NULL,
        name VARCHAR(512),
        company VARCHAR(512),
        work VARCHAR(512),
        email VARCHAR(512),
        tel VARCHAR(512),
        message LONGTEXT,
        PRIMARY KEY(id)
) ENGINE=InnoDB CHARACTER SET utf8;

from the following code:
db.define_table('contact',
    Field('name',label=T('Name')),
    Field('company',label=T('Company')),
    Field('work',label=T('Work')),
    Field('email',label=T('email')),
    Field('tel',label=T('Tel')),
    Field('message',type='text',label=T('Message'))
    )

db.contact.name.requires = IS_NOT_EMPTY()
db.contact.email.requires = [IS_NOT_EMPTY(), IS_EMAIL()]


On Nov 15, 8:50 am, mdipierro <mdipie...@cs.depaul.edu> wrote:
> can you show us sql.log? Can you also show us the model?
>
> there seem to be a 'SUBSTRING' in CREATE TABLE and I have no clue how
> it go in there. web2py does not write it.
>
> There are things that work in sqlite even if they should not.
>
> On Nov 14, 9:59 am, Benigno <bca...@albendas.com> wrote:
>
> > Hi,
>
> >     I have just installed a working application (working on sqlLite)
> > and now need to move it to MySQL, I have created a DB, and user with
> > access rights (on localhost), and changed db.py db definition to
> > 'mysql://username:passw...@localhost/dbname'
>
> >     I am getting the following error when I try to access any page on
> > the application:
>
> > S'Traceback (most recent call last):
> > File "/Users/benigno/PyProjects/AlbenDas_web2py/gluon/restricted.py",
> > line 184, in restricted\n  File 
> > "/home/albendas/public_html/www.albendas.com/applications/domotica/models/db.py",
> >  line 52, in
> > <module>
> > auth.define_tables()                         # creates all needed
> > tables
> > File "/Users/benigno/PyProjects/AlbenDas_web2py/gluon/tools.py", line
> > 748, in define_tables
> > File "/Users/benigno/PyProjects/AlbenDas_web2py/gluon/sql.py", line
> > 1205, in define_table
> > File "/Users/benigno/PyProjects/AlbenDas_web2py/gluon/sql.py", line
> > 1607, in _create
> > File "/Users/benigno/PyProjects/AlbenDas_web2py/gluon/sql.py", line
> > 879, in <lambda>
> > File "/var/lib/python-support/python2.5/MySQLdb/cursors.py", line 166,
> > in execute
> >    self.errorhandler(self, exc, value)
> > File "/var/lib/python-support/python2.5/MySQLdb/connections.py", line
> > 35, in defaulterrorhandler
> >    raise errorclass, errorvalue\nProgrammingError: (1064, "You have an
> > error in your SQL syntax; check the manual that corresponds to your
> > MySQL server version for the right syntax to use near \'SUBSTRING
> > (auth_user.registration_key,1,1))\
> > ) ENGINE=InnoDB CHARACTER SET utf8\' at line 8")'
>
> > My MySQL Version is: MySQL 5.0.51a-3ubuntu5.4
>
> > Any help appreciated.
> > Benigno.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to