Thank you Massimo!

The driver did return None and setting the driver manually did the
trick.

Is this an issue with web2py or did I somehow setup my machine
incorrectly?



On Oct 25, 6:15 pm, Massimo Di Pierro <[email protected]>
wrote:
> try:
>
> from gluon.dal import MSSQLAdapter
> print MSSQLAdapter.driver
>
> My guess isthat it is failing to import pyodbc from dal.py somehow and
> the driver should should be set to
>
>    driver = globals().get('pyodbc',None)
>
> is set to None instead.
>
> On Oct 25, 10:20 am, CJM <[email protected]> wrote:
>
>
>
>
>
>
>
> > I'm unable to get web2py to connect to mssql.
>
> > <type 'exceptions.RuntimeError'>(Failure to connect, tried 5 times:
> > 'NoneType' object has no attribute 'connect')
>
> > My connection string is: db = DAL('mssql://
> > testUser:password1@localhost/testDB')
>
> > Environment
> >   Windows Server 2008 R2, 64-bit operating system
> >   SQL Server 2008 R2, local.
> >   Web2py: source code install version 1.99.2 (2011-09-26 06:55:33)
> > stable.
> >   pyodbc
> >   Python 2.7.2
>
> > I've tested that I can connect using the pyodbc. The following code
> > works:
>
> > import pyodbc
> > cnxn = pyodbc.connect('DRIVER={SQL
> > Server};SERVER=localhost;DATABASE=testDB;UID=testUser;PWD=password1')
> > cursor = cnxn.cursor()
> > cursor.execute("select * from tbUsers")
> > rows = cursor.fetchall()
> > for row in rows:
> >   print row
>
> > Thanks for your time.
>
> > Corey.

Reply via email to