web2py ships with gluon.contrib.pypyodbc, which is a pure Python ODBC driver. If the DAL does not find pyodbc installed, it falls back to pypyodbc, which it renames to pyodbc in the import statement (which is why you see pyodbc in the list of available drivers).
Maybe try importing pypyodbc in IDLE and see if you can connect to MSSQL. If that doesn't work, go ahead and install pyodbc, and see if that works. If that doesn't work, the problem is probably with your connection string or MSSQL setup. Anthony On Thursday, June 23, 2016 at 5:22:57 AM UTC-4, soumik chaudhuri wrote: > > > Hello All, > > Greetings. > > I'm new to web2py. I'm trying to build a dynamic webpage using > web2py(Python 2.7) and sql server at the backend. While I'm able to > connect to sql server using sql management studio and work, I cannot > connect to sql using web2py. There are a lot of solutions offered on this > group, probably I'm the incompetent one not being able to use those > fruitfully. > > I'm using Python on a Windows 64 bit machine, and using 32 bit version of > Python. I have used 64 bit version, and got the same errors that I get now. > > List of problems: > > I used this code in db.py: db= DAL(mssql://username:password @ > servername\schema/database) (please ignore the underline) > And get a big error : > <type 'exceptions.RuntimeError'> Failure to connect, tried 5 times. > > > But when I use db= DAL(sqlite://webform.sqlite), everything works fine. > > 2. When I try to import pyodbc using Python 2.7 IDLE, I get this: > > ImportError: No module named pyodbc. > > 3. When web2py starts, it lists the " Database drivers available" at the > console. I can see pymysql, Mysqldb, sqlitee3 and pyodbc among others, but > not MSSQLDb. Is that a problem? > > > Thank you for your time in advance. > -Som -- 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.