ADO/ODBC call via Python/IIS
David Fuess
fuess at att.net
Wed Feb 7 20:50:55 EST 2001
Here is the beginning of my SQL Server class:
class Database:
def __init__(self,Name,Server="Default",Arg=""):
self.adoConn = None
self.adoRS = None
self.RecordCount = 0
self.eof = 1
self.ConnectString = "database=%s;driver={SQL
Server};QueryTimeout=300;server=%s;uid=sa%s"%(Name,Server,Arg)
self.Schema = {}
if AutoOpenOnInit:
self.Open(Name)
def Open(self,Name):
if self.adoConn is not None:
self.Close()
self.adoConn = win32com.client.Dispatch('ADODB.Connection')
self.adoConn.CursorLocation = 3
self.adoConn.CommandTimeout = 900
self.adoConn.Open(self.ConnectString)
if AutoloadSchema:
self.LoadSchema()
And so on ...
I use it regularly to connect to SQL Server Databases. It is DSNless
in that it attaches directly to SQL Server without any specific DSN
assignments. It has nothing to do with IIS, only ADO.
Dave
On Wed, 7 Feb 2001 17:57:47 -0600, "dsavitsk" <dsavitsk at e-coli.net>
wrote:
>maybe not the error here, but you need a ";" at the end of the string ...
>see below.
>
>> adoConn.Open('driver=SQL
>> Server;server=sql0;uid=xxx;pwd=yyy;database=zzz;')
>
>
More information about the Python-list
mailing list