[python-sybase] python-sybase + FreeTDS + MS SQL Server

Chris Curvey Chris Curvey <chris at chriscurvey.com>
Tue, 3 Aug 2004 10:30:50 -0400 (GMT-04:00)

-----Original Message-----
From: Charles Bearden <Charles.F.Bearden@uth.tmc.edu>
Sent: Aug 3, 2004 10:22 AM
To: Kevin Jacobs <jacobs@theopalgroup.com>
Cc: python-sybase@www.object-craft.com.au
Subject: RE: [python-sybase] python-sybase + FreeTDS + MS SQL Server

> -----Original Message-----
> From: Kevin Jacobs [mailto:jacobs@theopalgroup.com]
> Sent: Monday, August 02, 2004 5:07 PM
> Charles Bearden wrote:
> >My question is how to supply authentication credentials to the MS SQL
> >Server.  I have to use a domain login userid like DOMAIN\username.
> >I create a Python script like this:
> >
> >------------------------------------------------------------
> >import Sybase
> >
> >dsn = 'theDb'
> >uid = 'MYDOMAIN\jrandomuser'
> >pwd = 'h4x0r'
> >cx = Sybase.connect(dsn, uid, pwd)
> >
> >cx.close()
> >------------------------------------------------------------
> >
> >
> >
> Try: uid = 'MYDOMAIN\\jrandomuser'
> Don't forget Python's string quoting rules!  ;)

Thanks for your response.  I should have mentioned that I had already
tried several permutations of quoting, including raw strings and the
escaped backslash you recommended.  Still no joy: the "Login failed for
user '(null)'" exception is still thrown.  And when I catch that
exception to print 'uid' before re-raising the exception, it prints the
UID correctly, with the single backslash between domain and username
(and it does so whether or not I've escaped the backslash).

The UID and password I am actually using are my personal domain
credentials that I type in every day to log on.  I'm puzzled by the
'(null)' user thing.  Does that mean that the string I am passing as UID
is not getting through, or that it is not recognized?

Are your user accounts on the SQL Server using the integrated NT login for authentication, or are they using a separate password?  I don't know for sure, but I'd wonder if FreeTDS supported the integrated login scheme.

Curvey Consulting