CJM,

Are you using apache using wsgi? if so, you're with me. You cannot
import pyodbc.
http://ochiba77.blogspot.com/2011/10/how-to-setup-web2py-apache-wsgi.html

If you're using rocket server, it should connect because I'm
connecting without any problem. Only difference with your environment
is that I'm using Windows 7. I use actual server(computer) name
instead of localhost. You can try that to see if it makes any
difference.

db = DAL('mssql:// testUser:password1@ServerName/testDB')

if it's mssql server express,

db = DAL('mssql:// testUser:password1@ServerName\SQLEXPRESS/testDB')


On 10月25日, 午後4:14, CJM <[email protected]> wrote:
> It's a source code install. Hench the line:
>
> > >  Web2py: source code install version 1.99.2 (2011-09-26 06:55:33)
>
> :)
>
> On Oct 25, 12:10 pm, Bruno Rocha <[email protected]> wrote:
>
>
>
>
>
>
>
> > are you using source code or .exe version of web2py?
>
> >http://zerp.ly/rochacbruno
> > Em 25/10/2011 13:31, "CJM" <[email protected]> escreveu:
>
> > > 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