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

Kevin Jacobs jacobs at theopalgroup.com
Mon, 02 Aug 2004 18:07:28 -0400


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.  When
>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!  ;)

-Kevin