Server SQL non existent or access denied

49 views
Skip to first unread message

Andrea Fae'

unread,
Aug 14, 2020, 6:47:36 AM8/14/20
to web2py-users
Hello I have this problem

c:\web2py>python web2py.py -S ITAsset -M -P
No handlers could be found for logger "web2py"
web2py Web Framework
Created by Massimo Di Pierro, Copyright 2007-2020
Version 2.14.6-stable+timestamp.2016.05.10.00.21.47
Database drivers available: sqlite3, imaplib, pyodbc, pymysql, pg8000
Traceback (most recent call last):
  File "c:\web2py\gluon\restricted.py", line 227, in restricted
    exec ccode in environment
  File "applications\ITAsset\models\db.py", line 35, in <module>
    check_reserved=['all'])
  File "c:\web2py\gluon\packages\dal\pydal\base.py", line 174, in __call__
    obj = super(MetaDAL, cls).__call__(*args, **kwargs)
  File "c:\web2py\gluon\packages\dal\pydal\base.py", line 473, in __init__
    "Failure to connect, tried %d times:\n%s" % (attempts, tb)
RuntimeError: Failure to connect, tried 5 times:
Traceback (most recent call last):
  File "c:\web2py\gluon\packages\dal\pydal\base.py", line 446, in __init__
    self._adapter = ADAPTERS[self._dbname](**kwargs)
  File "c:\web2py\gluon\packages\dal\pydal\adapters\base.py", line 60, in __call__
    obj = super(AdapterMeta, cls).__call__(*args, **kwargs)
  File "c:\web2py\gluon\packages\dal\pydal\adapters\mssql.py", line 159, in __init__
    if do_connect: self.reconnect()
  File "c:\web2py\gluon\packages\dal\pydal\connection.py", line 125, in reconnect
    self.connection = f()
  File "c:\web2py\gluon\packages\dal\pydal\adapters\mssql.py", line 157, in connector
    return self.driver.connect(cnxn, **driver_args)
  File "C:\Python27\lib\site-packages\pypyodbc.py", line 2454, in __init__
    self.connect(connectString, autocommit, ansi, timeout, unicode_results, readonly)
  File "C:\Python27\lib\site-packages\pypyodbc.py", line 2507, in connect
    check_success(self, ret)
  File "C:\Python27\lib\site-packages\pypyodbc.py", line 1009, in check_success
    ctrl_err(SQL_HANDLE_DBC, ODBC_obj.dbc_h, ret, ODBC_obj.ansi)
  File "C:\Python27\lib\site-packages\pypyodbc.py", line 987, in ctrl_err
    raise DatabaseError(state,err_text)
DatabaseError: (u'08001', u'[08001] [Microsoft][ODBC SQL Server Driver][DBNETLIB]Server SQL inesistente o accesso negato.')


My uri is 

uri       = mssql4://sa:password@TS-SQL2016R2\SQLEXPRESS/itassetdb

Do I have to install any ODBC SQL Server Driver on my client? In which way? I think I'm using pyodbc driver with python...
Can you suggest me anything?
Thanks so much

Andrea Fae'

unread,
Aug 15, 2020, 2:31:31 AM8/15/20
to web2py-users
Please can anyone help me? thank you

villas

unread,
Aug 15, 2020, 11:27:41 AM8/15/20
to web2py-users
>> Do I have to install any ODBC SQL Server Driver on my client?

Hi Andrea
I feel your frustration and, although I do not use mssql,  I believe you will certainly require a suitable ODBC driver installed so you can then connect to that datasource using pyobc.
Note that you should be able to use the pyodbc library independently from web2py.
I hope that other mssql users can give better advice.
All the best

Andrea Fae'

unread,
Aug 16, 2020, 5:45:58 AM8/16/20
to web2py-users
Hello Villas, first thanks so much. You are gently.
I will have possibility tomorrow to test. I just installed ODBC driver 17 in my client, so tomorrow I will test first of all if with a windows DSN connection it's possible to connect to SQL server 2016. After it I will try using web2py...But I don't know the implication about windows ODBC driver, pyodbc (it's another odbc driver...so independent from windows ODBC driver I think), and I don't know exactly if my DAL syntax is correct or not, because I found different syntax in the web.
If there will be anyone who could help me I will be very grateful.
Thank you so much Villas!!

AGRogers

unread,
Aug 18, 2020, 7:05:40 PM8/18/20
to web...@googlegroups.com
Hi Andrea 


pyODBC uses the Microsoft ODBC driver for SQL Server. If your version of the ODBC driver is 17.1 or later, you can use the Azure Active Directory interactive mode of the ODBC driver through pyODBC.

The numbers might not match yours but the concept should be the same - pyodbc goes through Microsoft odbc. 

It's been a while since I have done something with any odbc driver. But my first step would be ensuring Microsoft ODBC is working fine. Maybe you have done that already. I used to just create a connection from, say, MS Office or Access and verify that I could read the data I needed. Then I would move onto whatever app it was that I was trying to set up with odbc. 




--
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+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/a3fd7654-838e-416b-b7f6-8c531388979ao%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages