I have used the following code in ADO:

# The following code creates a connection object,
# assigns the connection string, opens the
# connection object, and then verifies a good
# connection.

oConn = Dispatch('ADODB.Connection')

oConn.ConnectionString = "Provider=SQLOLEDB.1;" +\
                         "Data Source=servername;" +\
                         "uid=loginid;" +\
                         "pwd=password;" +\
                         "database=databasename"

oConn.Open()
if oConn.State == adStateOpen:
    print "Database connection SUCCEEDED"
else:
    print "Database connection FAILED"

Hope this helps

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to