On May 21, 2012, at 1:08 PM, Random wrote:
> I am also getting the same error when I try to setup a DB connection in
> Django. It is automatically putting two forward slashes on my username.
The web2py parser wants forward slashes ('/'), not backslashes.
db = SQLDB('mssql://username:password@/server/instance/databasename')
However, the error you're getting is earlier than that. The MSSQL adapter does
this:
driver = globals().get('pyodbc',None)
...and the implication of the error message is that an earlier import pyodbc
failed.
>
> On Monday, May 21, 2012 1:48:34 PM UTC-5, Random wrote:
> Hello everyone,
>
> It seems that I'm unable to connect to a mssql database. I am getting the
> error:
>
> Traceback (most recent call last):
> File "gluon/dal.py", line 5955, in __init__
> File "gluon/dal.py", line 2280, in __init__
> RuntimeError: Unable to import driver
>
> when using the connection string:
>
> db = SQLDB('mssql://username:password@\\server\instance/databasename')
>
> However I am able to connect using pymssql module in regular Python 2.7 using
> the connection string (with the same credentials):
>
> pymssql.connect(host='hostname', user='username', password='password',
> database='database')
>
> Any ideas? Thanks in advance.
>