[Tutor] pymssql or ODBC

Chris Hengge pyro9219 at gmail.com
Fri Sep 15 09:19:00 CEST 2006


looking at your link, is your con wrong? for example...
the one on the link you provided is written:
con = ("Driver={SQL Server};", "Server=whatever", etc... 

I am not at work so I dont have the server to run this code against, but
it looks like you are doing what I've been trying to accomplish :]

On Fri, 2006-09-15 at 16:53 +1000, Joe Healy wrote:
> On windows we tend to use:
> 
> import dbi, odbc
> 
> con = odbc.odbc("driver={*SQL* Server};server=(local);database=DBNAME;uid=sa;pwd=;")
> cur = con.cursor()
> 
> cur.execute("begin tran")
> 
> # your code here
> 
> 
> 
> cur.execute("commit")
> 
> cur.close()
> 
> 
> I think if you leave off the uid and pwd parts, it will use windows authentication. (maybe)
> 
> I have never managed to find much documentation on this.
> 
> I tend to use http://www.carlprothman.net/Default.aspx?tabid=90 for connection strings.
> 
> Once we have the cursor object it is just the python db api.
> 
> Hope that helps.
> 
> Joe
> 
> 
> 
> Chris Hengge wrote:
> > Does anyone know how to make pymssql use windows authentication?
> >  
> > Also, can anyone point me to a simple ODBC guide for SQL?
> >  
> > I'd like to use ODBC if I can so that users of my software dont have 
> > to install extra libraries to use my utilities.
> >  
> > Thanks.
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > Tutor maillist  -  Tutor at python.org
> > http://mail.python.org/mailman/listinfo/tutor
> >   
> 
> 



More information about the Tutor mailing list