MS SQL Server: NT Authentication. Possible?

Tim Golden tim.golden at viacom-outdoor.co.uk
Fri Aug 18 08:37:28 EDT 2006


[Dirk Hagemann]

| I think the adodbapi module is interesting. I just tried it 
| out but got this error:
| 'Exception occurred.', (0, 'Microsoft OLE DB Provider for ODBC
| Drivers', "[Microsoft][ODBC SQL Server Driver][SQL Server]Login failed
| for user '(null)'. Reason: Not associated with a trusted SQL Server
| connection.", None, 0, -2147217843), None)

| Do I have to make some settings at the MS SQL Server? 

Yes: your (Windows) user has to be set up by one means
or another to allow trusted connection to the db. I'm 
not really a SQL Server DBA but I believe it's easy
enough to set up.

| I just can't find a simple example how to use adodbapi 
| with NT authentication...

This works for me against a database I know I have
trusted access to (eg via Query Analyzer). The server
is VODEV1, the database is EVOBACK. The rest is boilerplate.

<code>
import adodbapi

db = adodbapi.connect ("Provider=sqloledb;Data Source=VODEV1;Initial
Catalog=EVOBACK;Integrated Security=SSPI;")
q = db.cursor ()
q.execute ("SELECT SYSTEM_USER")
print q.fetchone ()
q.close ()

</code>

TJG

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________



More information about the Python-list mailing list