From: Charles B. <Cha...@ut...> - 2004-08-04 07:22:43
|
> -----Original Message----- > From: Kevin Jacobs [mailto:ja...@th...] > Sent: Monday, August 02, 2004 5:07 PM >=20 > Charles Bearden wrote: >=20 > >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 =3D 'theDb' > >uid =3D 'MYDOMAIN\jrandomuser' > >pwd =3D 'h4x0r' > >cx =3D Sybase.connect(dsn, uid, pwd) > > > >cx.close() > >------------------------------------------------------------ > > > > > > > Try: uid =3D 'MYDOMAIN\\jrandomuser' >=20 > 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? Thanks, Chuck Bearden Systems Analyst III School of Health Information Sciences University of Texas at Houston 713.500.3954 (voice) 713.500.3907 (fax) Cha...@ut... |
From: Charles B. <Cha...@ut...> - 2004-08-04 07:33:36
|
> -----Original Message----- > From: Chris Curvey [mailto:cc...@ea...] > Sent: Tuesday, August 03, 2004 9:31 AM >=20 > -----Original Message----- > From: Charles Bearden <Cha...@ut...> > Sent: Aug 3, 2004 10:22 AM >=20 > > -----Original Message----- > > From: Kevin Jacobs [mailto:ja...@th...] > > 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. > When > > >I create a Python script like this: > > > > > >------------------------------------------------------------ > > >import Sybase > > > > > >dsn =3D 'theDb' > > >uid =3D 'MYDOMAIN\jrandomuser' > > >pwd =3D 'h4x0r' > > >cx =3D Sybase.connect(dsn, uid, pwd) > > > > > >cx.close() > > >------------------------------------------------------------ > > > > > > > > > > > Try: uid =3D 'MYDOMAIN\\jrandomuser' > > > > Don't forget Python's string quoting rules! ;) >=20 >=20 > 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). >=20 > 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? >=20 >=20 > 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. Thanks for the suggestion--I'll check that out. I'm a Linux exile in Windows-land here, except that I'm trying to get this Linux host to talk to MS SQL, and I am the first to admit that there is a great deal I don't know about Windows authentication. Chuck Bearden Systems Analyst III School of Health Information Sciences University of Texas at Houston 713.500.3954 (voice) 713.500.3907 (fax) Cha...@ut... |
From: Chris C. <cc...@ea...> - 2004-08-04 07:31:21
|
-----Original Message----- From: Charles Bearden <Cha...@ut...> Sent: Aug 3, 2004 10:22 AM To: Kevin Jacobs <ja...@th...> Cc: pyt...@ww... Subject: RE: [python-sybase] python-sybase + FreeTDS + MS SQL Server > -----Original Message----- > From: Kevin Jacobs [mailto:ja...@th...] > 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. 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! ;) 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 www.chriscurvey.com |
From: Charles B. <Cha...@ut...> - 2004-08-05 09:03:33
|
> > >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 =3D 'theDb' > > >uid =3D 'MYDOMAIN\jrandomuser' > > >pwd =3D 'h4x0r' > > >cx =3D Sybase.connect(dsn, uid, pwd) > > > > > >cx.close() > > >------------------------------------------------------------ > > > > > > > > > > > Try: uid =3D 'MYDOMAIN\\jrandomuser' > > > > Don't forget Python's string quoting rules! ;) >=20 >=20 > 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). >=20 > 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? >=20 >=20 > 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. Yes, FreeTDS does handle domain logins correctly. In fact, I've now gotten it to work with the libiodbc driver manager and mx.ODBC. Also, the FreeTDS 'tsql' utility can connect with a domain login: $ ./tsql -S servername -U 'DOMAIN\uname' locale is "en_US.UTF-8" locale charset is "UTF-8" Password:=20 Msg 5703, Level 0, State 1, Server UT160617, Line 0 Changed language setting to us_english. 1> The only trick is not to supply the password on the command line, but at the prompt after executing the tsql command. But basically, FreeTDS as used by other interfaces is able to talk to the server in question, whatever the authentication method. For now I will probably just go with the mx.ODBC.iODBC interface, since it works. For security reasons, it would probably be good to get db-specific uids and passwords, rather than using my own credentials (I'm not the sysadmin or DBA here, so I don't make the policies). If the python-sybase developers think it would be useful, I would be willing a little later to send TDS dumps for successful logins via iODBC and for unsuccessful attempts via python-sybase. I don't know if it is a high priority for this project to make domain logins work with FreeTDS. Thanks for the responses, Chuck |