[Tutor] pymssql or ODBC
János Juhász
janos.juhasz at VELUX.com
Fri Sep 15 13:52:23 CEST 2006
I am using the next two solution for connecting to our mssql server
when the odbc connection is set for all the PCs, I use this:
import dbi, odbc
cn = odbc.odbc('DSN=scalaDB;UID=query;PWD=query;DATABASE=DB')
When there is no connection set and distributed, I usually choose this
import win32com.client
cn =win32com.client.Dispatch('ADODB.connection')
cn.Provider='sqloledb'
cn.Open('Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security
Info=False;Initial Catalog=production;Data Source=MyServername')
To create the correct connection string I follow this simple method:
-right click on the desktop and create a new text document
-save it as connection.udl
-double click on it, and it will be opened by windows to set up all the
possible parameters
-test the connection
-open it with notepad and copy the string from it
Yours sincerely,
______________________________
János Juhász
> [Chris Hengge]
> | Does anyone know how to make pymssql use windows authentication?
> I'm fairly sure, from previous experience and a brief
> perusal of the source, that pymssql doesn't offer the
> possibility of pass-through authentication. When I use
> it, I have to ask my DBA to set up a specific user.
> The usual place to look for connection strings for
> ODBC, ADO etc. is http://connectionstrings.com. I just
> tried downloading the latest mxODBC and using the connection
> string from there, only to get an internal error... I'll try
> a new download just in case.
> But you've also got ADO: the adodbapi module, while unmaintained,
> does in fact work. It's a mite quirky, due partly from having to
> work round variations in ADO versions. But we do use it for
> pass-through authentication. (connectionstrings.com again for DSN).
More information about the Tutor
mailing list